Closing a Modal Popup from a
I have this code:
- <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
function ShowPopup(message) {
var _dialog;
$(function () {
var iframe = $('<iframe frameborder="0" marginwidth="0" marginheight="0" src="clienti.aspx" width="680" height="460" allowfullscreen></iframe>');
_dialog = $("<div></div>").append(iframe).appendTo("body").dialog({
autoOpen: true,
modal: true,
resizable: false,
width: "720",
height: "520",
close: function () {
iframe.attr("src", "");
}
});
modal: true
});
};
function CloseModal(frameElement) {
alert(frameElement);
if (frameElement) {
var dialog = $(frameElement).closest(".modal");
alert (dialog)
if (dialog.length > 0) {
alert('ok');
dialog.modal("hide");
}
}
}
</script>
I call these functions to open a iframe containing a ASPX page with only a Gridview1 with data and one button for each row. I use this button to select the row and close the iframe by this call:
If (Not ClientScript.IsStartupScriptRegistered("chiudi1")) Then
ClientScript.RegisterStartupScript(Me.GetType(), "chiudi1", " window.parent.CloseModal(window.frameElement);", True)
End If
I have disseminated alert in CloseModal. The first two are displayed to prove the function is called from the iframe loaded page.but the third is not called, to prove that the modal windows is not found. No action is taken. I don't find any good advice. Can anybody help me?
Thank you very much
Mauro Zanin