I have a jQuery UI Dialog working great on my ASP.NET page:
jQuery(function() {
jQuery(\"#dialog\").dialog({
draggable: true,
resizable:
I know this is an old question, but for anyone who have the same issue there is a newer and simpler solution: an "appendTo" option has been introduced in jQuery UI 1.10.0
http://api.jqueryui.com/dialog/#option-appendTo
$("#dialog").dialog({
appendTo: "form"
....
});
Use this line to make this work while using the modal:true option.
open: function (type, data) {
$('.ui-widget-overlay').appendTo("form"); $(this).parent().appendTo("form");
},
The exact solution is;
$("#dialogDiv").dialog({ other options...,
open: function (type, data) {
$(this).parent().appendTo("form");
}
});
ken's answer above did the trick for me. The problem with the accepted answer is that it only works if you have a single modal on the page. If you have multiple modals, you'll need to do it inline in the "open" param while initializing the dialog, not after the fact.
open: function(type,data) { $(this).parent().appendTo("form"); }
If you do what the first accepted answer tells you with multiple modals, you'll only get the last modal on the page working firing postbacks properly, not all of them.
FWIW, the form:first technique didn't work for me.
However, the technique in that blog article did:
http://blog.roonga.com.au/2009/07/using-jquery-ui-dialog-with-aspnet-and.html
Specifically, adding this to the dialog declaration:
open: function(type,data) {
$(this).parent().appendTo("form");
}
Fantastic! This solved my problem with ASP:Button event not firing inside jQuery modal. Please note, using the jQuery UI modal with the following allows the button event to fire:
// Dialog Link
$('#dialog_link').click(function () {
$('#dialog').dialog('open');
$('#dialog').parent().appendTo($("form:first"))
return false;
});
The following line is the key to get this working!
$('#dialog').parent().appendTo($("form:first"))