22/08/2012 by Nitesh

How to add a piece of Javascript just before the end of Form Tag in ASP.Net

In ASP.Net, we often require to add some piece of Javascript from Code-behind that should get added towards the end of <form> tag and not in the header of the form. For this, we need to use RegisterStartupScript function. The syntax to use the function is as below:

Page.RegisterStartupScript(this.GetType(),"key_for_script",
"alert('Hey! This gets alerted after the page has loaded.'",true);
#ASP.Net#Javascript#Utilities