If you have a website that has master and content pages and you want to add some javascript code
on content page which will run when page is loaded then add this code to your content page code
behind pageload event.
Here you watch how do i get javascript run from content page.
In the above Asp.Net Example if you register more than one script in this way, there is no guarantee in which order they will be executed, if you want to control the order of execution, you can combine all into one script in proper order and register them as one script.
Here you watch how do i get javascript run from content page.
protected void Page_Load(object sender, EventArgs e)
{
Type PageType = GetType();
const string YourscriptName = "Popup";
if (!ClientScript.IsStartupScriptRegistered(PageType ,YourscriptName ))
{
ClientScript.RegisterStartupScript(PageType , YourscriptName, "alert('Hello !')",
true);
}
}
In the above Asp.Net Example if you register more than one script in this way, there is no guarantee in which order they will be executed, if you want to control the order of execution, you can combine all into one script in proper order and register them as one script.