Reputation: 5660
I have a modal dialog showing up and the user can make some changes and then click a 'Save' button. I need that to totally post back the whole page. What would you suggest? I just assumed the button would fire off regardless of the jQuery.
Upvotes: 1
Views: 12994
Reputation: 429
The basics I use are:
Create an ASP button on the page outside of the modal div
<asp:Button ID="hiddenButton" runat="server" onclick="hiddenButton_Click" style="visibility:hidden" />`
Assuming you have the Save button already in your modal div, call the button click event in JavaScript(this was taken from a jQuery dialog event):
buttons: {
Save: function () {
$(this).dialog('close');
$("#<%=hiddenButton.ClientID %>").click();
}
}
Upvotes: 2
Reputation: 18333
put an asp button on the page and hide it with css in the onclose event of the dialog window, call aspButton.click
<asp:button id="myButton" runat="server" OnClick="myButton_Click" style="visible:hidden;" />
...
$('#' + <%= myButton.ClientID %>).click();
Upvotes: 3
Reputation: 26190
You could force a post back from Javascript:
__doPostBack(id,'');
To do this directly from a control, like a button, use OnClientClick:
<asp:Button id="myButton" runat=server OnClientClick="__doPostBack(id,'');" />
Upvotes: 8