programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Thursday, April 23, 2015

Execute JavaScript function from ASP.NET or codebehind C# code file

Execute  a Javascript function from c# code:

Calling a JavaScript function from codebehind is quiet simple, yet it confuses a lot of developers.

Here's how to do it. Declare a JavaScript function in your code as shown below:

JavaScript function on aspx page :

<head runat="server">

    <title>Call JavaScript From CodeBehind</title>

    <script type="text/javascript">

        function alertMe()


C# code for call javascript function on aspx.cs page :

protected void Page_Load(object sender, EventArgs e)


    if (!ClientScript.IsStartupScriptRegistered("alert"))



            "alert", "alertMe();", true);



Other Related Post:

No comments:

Post a Comment