How to create a dummy postback in asp.net using javascript/jQuery?
Some situation user need to trigger the postback dynamically from client side using javascript or jQuery. In this situation you can follow this method.
Asp Button
When you trigger the click function like the above format, the server side dmycall method will call with serverside postback.
Asp Button
<asp:Button ID="dmypbbtn" runat="server" OnClick="dmycall" style="display:none;" />
javascript code
document.getElementById("<%=dmypbbtn.ClientID%>").click();
jQuery Code
$("#<%=dmypbbtn.ClientID%>").trigger('Click');
When you trigger the click function like the above format, the server side dmycall method will call with serverside postback.
Nhận xét
Đăng nhận xét