I am working with Asp.Net. asp:button's OnClick event like the below. I would like to have jquery call "Save_Click' event. Is it possible?
Home.aspx.cs code
protected void Save_Click(object sender, EventArgs e)
{
//code to update database goes here....
}
jquery code
$("#ABC").click(function() {
$($get("Save")).click();
开发者_JAVA百科 return false;
});
.aspx
<asp:Button id="Save" runat="server" Text="Save Details" OnClick="Save_Click" />
<input id="ABC" type="button" value="button" />
Use __doPostBack function:
$("#ABC").click(function() {
__doPostBack('Save');
return false;
});
<asp:Button id="Save" runat="server" Text="Save Details" OnClientClick="Save_Click" />
This is will work or u can do something like :
$(document).ready(function() {
$("input[id$='yourinputbutton']").click(function() {
// Do client side button click stuff here.
});
});
Are you looking for Jquery asp.net Button, What exactly you want to acheive?
精彩评论