Wednesday, 11. November 2009
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.