After you have registred the System.Web.UI, then you can invoke a class ‘ScriptManager‘ which manages ASP.Net script libraries and script files, partial page rendering, and client proxy class generation for Web and application services. After invoking the ScriptManager class, we have now access to RegisterClientScriptBlock which has 5 agruments namely Control control, Type type, string key, string script, bool addScriptTags. Inshort we have the following method
void ScriptManager.RegisterClientScriptBlock(Control control, Type type, string key, string script, bool addScriptTags)
It registers a client script block with the System.Web.UI.ScriptManager control for use with a control that is inside an System.web.ui.update panel control and then adds the script block to that page.
It has the following exceptions
Now let us see the arguments called
Type type : Here we use typeof(page) which represents an .aspx file, also known as a web forms page, requested from a server that hosts an ASP.Net web application.
String key : It refers to the name you want to give to the registered client script block (Remember giving same name to more than one Registerclientscript block will break the functionality of the script and both the scripts will not work).
Bool AddScriptTags : This feature allows you either to enable or disable script tags. (Either true or false).
So inshort, here is the complete code for the above explanation.
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "script", " myfunction()", true);