Dialog + buttons + modal + postback
Hi all,
I'm trying to put JQuery Dialog into my ASP.Net application. The problem I'm getting is that when the user clicks on the "I Agree" button I want to do some server side work and then go back to the same page with a confirmation. So the way I thought about doing it was creating a asp.net button, set to display:none and I would call this from the dialog buttons. Unfortunately I can't call ASP.Net controls from the dialog until I assign the dialog to the form:
- $dialog.parent().appendTo(jQuery("form:first");
But if I do that, and I'm using modal=true, then the dialog buttons become "hidden" behind the dialog overlay. :( Here's the latest javascript (with previous attempts commented out).
- $(function () {
- //var dlg =
- $("#declaration-confirmation").dialog({
- autoOpen: false,
- height: 400,
- width: 450,
- buttons: {
- "I agree": function () {
- $('#<%=btnAgreeTerms.ClientID%>').click();
- $(this).dialog("close");
- },
- Cancel: function () {
- $(this).dialog("close");
- }
- }
- });
- //dlg.parent().appendTo(jQuery("form:first"));
- });
- function SubmitForm() {
- Page_ClientValidate();
- if (Page_IsValid) {
- //$('#declaration-confirmation').dialog({ modal: true });
- $("#declaration-confirmation").dialog("open");
- //$('#declaration-confirmation').dialog({ modal: true });
- //$("#declaration-confirmation").parent().appendTo(jQuery("form:first"));
- return false;
- }
- else {
- return false;
- }
- }
Any suggestions on how to get past this problem?
Kind regards