开发者

Asp.net onclick event with jQuery?

开发者 https://www.devze.com 2023-03-19 00:55 出处:网络
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?

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消