How to call javascript function in C#.net?

By James J

Call the javascript function on button click event...

<script type="text/javascript">
function Call()
{
     alert(
"Call Function");
}
</script>


protected void Page_Load(object sender, EventArgs e)
{
    
Button btn= new Button();
     btn.
ID = "Button1";
     btn.
Attributes.Add("runat", "server");
    btn.
Attributes.Add("onclick", "Call()");
     btn.
Text = "Check";
    
this.form1.Controls.Add(btn);
}



How to call javascript function in C#.net?  (1566 Views)