How do we call a Javascript function from code-behind?

 Posted by vishalneeraj-24503 on 12/6/2013 | Category: JavaScript Interview questions | Views: 993 | Points: 40
Answer:

Suppose,we have a Javascript function as below:-

<script type="text/javascript">

function alert_msg()
{
alert("Vishal Kumar");
}
</script>


To call above function from Code behind,write below code in any button click:-


ScriptManager.RegisterStartupScript(Page, typeof(Page), "message", "javascript:alert_msg();", true);


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response