3

I've been researching the use of dialog boxes in ASP.NET. It seems much different for Web-based applications than dialog boxes I have used in Windows applications.

I have an ASP.NET form with its own submit button and code. In that submit button's event handler, among its other code, I would like a modal dialog box to ask the user for additional information and return to executing the rest of the submit button's code. The question is how to about doing that.

JQueryUI Dialog Modal Form is an option I have looked at. I'm just wondering about how to continue executing the ASP.NET form's submit button code after the dialog box goes away. Also, I have to take into consideration the difference between server-side/client-side coding.

Any ideas/suggestions are greatly appreciated.

Note: I'm coding this with VS2003 and .Net 1.1

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Thomas
  • 35
  • 1
  • 7
  • 1
    FYI, this is ASP.NET, not ASP. Also, maybe time for an update? You're talking about eight year-old, [unsupported software](http://support.microsoft.com/lifecycle/?p1=1249) in the present tense. – John Saunders Dec 09 '11 at 01:57

2 Answers2

3

See my answer on the question linked below, I use a hidden asp:button for the callback:

ASP.NET with jQuery popup dialog: how to post back on dialog closing

Markup:

<span onclick='showjQueryUIDialogOkBtnCallback("<%= btnHidden.ClientID%>","<%= yourModalDialog.ClientID%>", "OK", true, 600,600)'>show dialog</span>

<div id="yourModalDialog" runat="server">
     your modal dialog div
</div>

<asp:button id="btnHidden" style="display:none" runat="server" onclick="btnHidden_Click"/>

Script:

 function showjQueryUIDialogOkBtnCallback(buttonToClick, dialogSelector, buttonTxt, isModal, width, height) 
 {
       var buttonOpts = {};
       buttonOpts[buttonTxt] = function () {
           $("#" + buttonToClick).trigger('click');
       };

       buttonOpts['Cancel'] = function () {
           $(this).dialog("close");
           $(this).dialog('destroy'); 
       }

       $(dialogSelector).dialog({
           resizable: false,
           height: height,
           width: width,
           modal: isModal,
           open: function (type, data) {
               $(this).parent().appendTo("form"); //won't postback unless within the form tag
           },
           buttons: buttonOpts

       });

       $(dialogSelector).dialog('open');

  }
Community
  • 1
  • 1
rick schott
  • 21,012
  • 5
  • 52
  • 81
1

I think what your best bet would be to use is the Modal Popup available in the AJAX Control ToolKit. It will allow you to basically handle the popup as though it is part of the form (which it is, essentially).

  • +1 I was thinking the same thing. There's also a client side javascript reference on MSDN. – Tim Nov 29 '11 at 20:30
  • I really want to but I'm coding this with VS2003 and .Net 1.1 which doesn't allow the Ajax ToolKit. I'll update my question with this vital info. – Thomas Nov 29 '11 at 20:39
  • -1 thanks for trying to help, but that won't work with .NET 1.1. – John Saunders Dec 09 '11 at 01:58