I got a problem in my Asp.net application.
When I try to save some data, I check if the data is right, When not I call a jquery dialog with the error message. But when my jquery dialog appears, my background form dissapears.
and I get a javascript error: “html parsing error unable to modify the parent container element before the child element is closed”.
This is my jquery dialog call in codebehind:
string script = "openDialog('" + text + "', '" + title + "');";
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "open", script, true);
This is my jquery dialog in my masterpage:
function openDialog(text, title) {
var $dialog = $('<div></div>')
.html(text)
.dialog({
autoOpen: false,
title: title,
modal: true,
height: 100,
width: 220,
buttons: {
Ok: function() {
$(this).dialog('close');
}
},
open: function(event, ui){
$('body').css('overflow','hidden');
}
});
$dialog.dialog('open');
}
I have some pages where I have the same code and there it works?
According to this link it is likely because the new div you are trying to add is being added before the page has completed rendering. Try this: