Reputation: 3279
I use following function in my ASP.NET page_load function to load a javascript function in my startup (I use masterpage):
((System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("Body")).Attributes["onload"] = "initialize()";
it seems that my javascript function is not called after postback, what is going wrong?
Upvotes: 0
Views: 679
Reputation: 26386
Why not use ClientScript.RegisterClientScriptBlock()
instead
string myscript = "<script type=\"text/javascript\">"+
"divTimer();" +
"initialize();" +
"</script>";
ClientScript.RegisterClientScriptBlock( this.GetType(), "myscript", myscript);
Upvotes: 2