Monday, 16 December 2013

Call javascript function from codebehind in asp.net

Here i will explain how to call javascript function from codebehind without assigning it to any control in asp.net.

We can call javascript functions in two ways


first way is

 System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script""document.getElementById('" + button2.ClientID + "').style.display='none';"true);


Seconda way you can call javascript function also

System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script""MyJavascriptFunction();"true); 

Like this we can call the javascript functions or buttons in codebehind without assigning it to any control

No comments:

Post a Comment