Friday, October 12, 2007

Calling a server side function from javascript.

Javascript code

function bind()
{

var btn = document.getElementById("Button1");
btn.click();

}


Html code
<table>
<tr style="display:none" ><td><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /></td></tr>
</table>


Code behind code

protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("
Button1 clicked");
}



No comments: