Page.ClientScript.RegisterStartupScript not working
Had a website with a master page and in the the page_load event I was calling Page.ClientScript.RegisterStartupScript to run some javascript based on the current state of the application. In the default.aspx page the script worked fine but in this other page the script was not getting called at all.
After much research I have learned that Page.ClientScript.RegisterStartupScript only works if the page has a form element that has the runat="server" set. Once I added a form element with runat="server" to the other page the script finally started getting called the same as it did on the default.aspx page which of course had already had a form element.
Comments
Post a Comment