User1575314614 posted
So I have a link on a page that opens a modal dialog that contains another asp.net page. That page will accept some user input and then process a postback. I then want to close the modal window without the user needing to click on anything.
My first thought was to just redirect the content of that window to a generic web page that just contains a script that closes the window. That way I can use this page for multiple uses, but I can't seem to figure out a script that will close it.
Any help would be greatly appreciated.
Here's how I open the dialog
<script type="text/javascript">
$(function () {
$('a.mDialog').click(function (e) {
e.preventDefault();
var $this = $(this);
var horizontalPadding = 30;
var verticalPadding = 30;
$('<iframe id="externalPage" class="externalPage" src="' + this.href + '" />').dialog({
title: ($this.attr('title')) ? $this.attr('title') : 'Dialog Title',
autoOpen: true,
width: 800,
height: 500,
modal: true,
resizable: false,
autoResize: true,
overlay: {
opacity: 0.5,
background: "black"
}
}).width(800 - horizontalPadding).height(500 - verticalPadding);
});
});
</script>
<a href="addPerson.aspx" class="mDialog" title="Add Person">add person</a>