PermaLink JQuery UI Dialog and ASP.Net button postbacks11/11/2009 06:40 PM
When you use JQuery UI's Dialog plugin to bring up a div as a dialog, it usually pulls the div out of the form to do this and then ASP.Net elements don't work.  I found this clean solution to this from Ravi's Software+Usability Blog:
In your dialog creation code, add an open event handler:
    $('#divDialog').dialog({
      bgiframe: true, autoOpen: false, height: 175,
      width: 600, minWidth: 200, modal: true,
      open: function(type,data) {
        $(this).parent().appendTo("form");
      }
    });
This will bring the ASP.Net elements back inside the form so they can post back to the ASPX page properly.

Comments :v

1. Carl Howarth05/12/2011 05:42:31 AM


Thank you sooooo much!

I have spent the morning messing around with nested updatepanels and never even considered that it may have been the JQ Dialog that was messing with me.




2. Dun07/14/2010 11:06:41 AM


You've just earned a medal from me. Any idea what to with UpdatePanel inside Dialog? Or should I make it more simple and just Iframeit there...?




3. Martijn Duiveman04/29/2010 11:43:13 AM


Thanks, this really helped me. I had a situation where multiple dialogs were on the page and because the inline function only runs when the dialog is opened, it does not conflict with the other dialogs. Thanks again.

Martijn




Start Pages
RSS News Feed RSS Comments Feed CoComment Integrated
The BlogRoll
Related Links
Calendar
February 2012
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Search
Contact Me