I have an app on jquery 1.5 with dialogs worked fine. While I have a lot of .live handlers, I changed this to .on. For that, I have to update jquery (now 1.8.3 an jquerui 1.
I simply had to add the ScriptManager to the page. Issue resolved.
This is also some work around:
$("div[aria-describedby='divDialog'] .ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-icon-only.ui-dialog-titlebar-close").click();
I got this error message because I had the div tag on the partial view instead of the parent view
In my case the problem was that I had called $("#divDialog").removeData();
as part of resetting my forms data within the dialog.
This resulted in me wiping out a data structure named uiDialog
which meant that the dialog had to reinitialize.
I replaced .removeData()
with more specific deletes and everything started working again.
So you use this:
var theDialog = $("#divDialog").dialog(opt);
theDialog.dialog("open");
and if you open a MVC Partial View in Dialog, you can create in index a hidden button and JQUERY click event:
$("#YourButton").click(function()
{
theDialog.dialog("open");
OR
theDialog.dialog("close");
});
then inside partial view html you call button trigger click like:
$("#YouButton").trigger("click")
see ya.
My case is different, it fails because of the scope of 'this':
//this fails:
$("#My-Dialog").dialog({
...
close: ()=>{
$(this).dialog("close");
}
});
//this works:
$("#My-Dialog").dialog({
...
close: function(){
$(this).dialog("close");
}
});