Where does RegisterStartupScript() actually put the JavaScript in the rendered document? We use this extensively to trigger JavaScript from the codebehind, and I've always wondered how the hell this works.
A:
You can use comments to keep tracking your javascript code in rendered html.
Braveyard
2009-11-10 23:09:44
A:
From MSDN:
Similar to the RegisterClientScriptBlock method, the RegisterStartupScript method emits the script just before the closing tag of the Page object's element. Be sure to include opening and closing elements around the script block string specified in the script parameter.
Gonzalo
2009-11-10 23:12:19
A:
RegisterClientScriptBlock() writes script block right after the <form runat="server"> tag.
RegisterStartupScript() writes script block right before the closing </form> tag.
IrishChieftain
2009-11-10 23:13:23