Client-side script generally refers to the class of computers programs on the web that are executed client side by the user’s browser, instead of the server-side (on the web -server).
Registering Client script from server useful when, you want certain java script to be executed when page finished loading or when user does a submit on the form.
You have a clientscriptmanager object on each aspx page. You have the object name is ClientScript; using ClientScript you can register the script in 4 modes:
1. RegisterClientScriptBlock() method add the script before the controls are rendered in the page. So the scripts we are registered can't access the controls inside the page.
Page.ClientScript.RegisterClientScriptBlock (this.GetType (), "RegisterClientScriptBlockMethod", "alert ('ScriptBlockRegistered”, true);
2. RegisterStartupScript() method add the script before the end of body tag after all the controls are rendered in the browser. So the registered script can access the controls inside the page.
Page.ClientScript.RegisterStartupScript (this.GetType (), "RegisterStartupScript","alert('StartupScriptRegistered'), true);
3. RegisterClientScriptInclude() method refer to an external .js file that includes various script behavior.
4. RegisterOnSubmitStatement() method registered the script on onSubmit event of a page.
"return alert('OnSubmit Registered')");