Calling Javascript From Asp.net Codebehind in .aspx.cs
Many times we need to invoke javascript function in codebehind of asp.net page ie. in .aspx.cs page.
There are many ways to accomplish this.
I will provide you a link which will show you how to invoke javascript in master and content page of asp.net
http://www.dotnetcurry.com/ShowArticle.aspx?ID=273
Other ways are as follows:
in .aspx.cs write following code:
Page.ClientScript.RegisterStartupScript(this.GetType(), “alert”, “Disconnect();”, true);
in .aspx write following code:
<script type=”text/javascript” language=”javascript”>
function Disconnect()
{
alert(‘Sucessfully Disconnected’);
}
</script>
Other way is:
Response.Write(“<script>alert(Successfully Disconnected”)</script>”);
Refer another good article at :
http://www.codedigest.com/Articles/ASPNET/314_Multiple_Ways_to_Call_Javascript_Function_from_CodeBehind_in_ASPNet.aspx
Recent Comments