Amol

Amol

  • NA
  • 208
  • 193.6k

How to call javascript written in aspx from code behind?

Nov 20 2011 12:53 AM

Here is the scenario i have to call javascript from server side
is it possible then please suggest

<html xmlns="http://www.w3.org/1999/xhtml">     <head runat="server"> <title>Untitled Page</title> <script type="text/javascript">     function test(x, y)     {       } </script> </head> <body>     <form id="form1" runat="server">     <div>         <asp:Button ID="Button1" runat="server" Text="Button"          onclick="Button1_Click"/>     </div>     </form> </body> </html>


protected void Button1_Click(object sender, EventArgs e) {     // do stuff (really going to a database to fill x and y) 
// call javascript function as test(x,y);  }

Answers (1)