JavaScript from within BP - code stage

rohanshankar

New Member
Hi,

Could you guide me through my code related to the below issue:

Page page = System.Web.HttpContext.Current.Handler as Page;
str = "page doesn't exist";
if (page != null)
{ str = "page exists!!";
}

There is runtime exception - object reference not set. I have the dll and reference mentioned in the Init page though.

Along with the above if you could additionally help me with the below:
I am trying to run this code through code stage in BP to call a java script function "JSFUNCTION" - the JS function already exists in the webpage.

System.Web.UI.Page page = new System.Web.UI.Page();
ClientScriptManager cs = page.ClientScript;
cs.RegisterStartupScript(page.GetType(), "Javascript", "JSFUNCTION(false,this);", true);


The run is successful but nothing happens on the page, the function works when called from Console (dev tool in browser).
 
Top