Skip to content Skip to sidebar Skip to footer

How to create a dummy postback in asp.net using javascript/jQuery?

In some situations, the user needs to trigger the postback dynamically from the client-side using javascript or jQuery. In this situation, you can follow this method.

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 a serverside postback.

Post a Comment for "How to create a dummy postback in asp.net using javascript/jQuery?"