I had some Javascript that I wanted to call on every Page_Load. I had an UpdatePanel on my page and I found that the Javascript wouldn't run on a PostBack. My problem was that I needed to user ScriptManager instead of Page.ClientScript. So I switched:
Page.ClientScript.RegisterStartupScript(typeof(Page), "onload", "alert('hello"');", true);
to:
ScriptManager.RegisterStartupScript(this, typeof(Page), "onload", "alert('hello"');", true);
And it worked!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment