[This documentation is preliminary and is subject to change.]
Gets the variable or array of variables passed into the modal dialog window.
This property is not supported for Metro style apps using JavaScript.
Syntax
| JavaScript | |
|---|
Property values
Type: Variant
the arguments that were passed when the dialog was created.
Remarks
The dialogArguments property applies only to windows that are created with the showModalDialog method and the showModelessDialog method.
Examples
The following example shows how to get information passed into a modal dialog window by using the dialogArguments property. The code corresponds to two different files. One file launches the modal window and the other file stores the code for the modal window.
This file launches the modal window and then sends an object to that modal window.
<HTML>
<HEAD>
<SCRIPT>
function fnLaunch()
{
var aForm;
aForm = oForm.elements;
var myObject = new Object();
myObject.firstName = aForm.oFirstName.value;
myObject.lastName = aForm.oLastName.value;
// The object "myObject" is sent to the modal window.
window.showModalDialog("modalDialogSource.htm", myObject, "dialogHeight:300px; dialogLeft:200px;");
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="fnLaunch();" >Launch The Dialog</BUTTON>
<FORM ID= "oForm">
First Name:
<INPUT TYPE="text" NAME="oFirstName" VALUE="Jane">
<BR>
Last Name:
<INPUT TYPE="text" NAME="oLastName" VALUE="Smith">
</FORM>
</BODY>
</HTML>
This file (modalDialogSource.htm), stores the code for the modal window. Get the object sent to this modal window by using the dialogArguments property.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/dialogArgumentsCallerEX1.htm
<HTML> <HEAD> <SCRIPT> var oMyObject = window.dialogArguments; var sFirstName = oMyObject.firstName; var sLastName = oMyObject.lastName; </SCRIPT> <title>Untitled</title> </head> <BODY STYLE="font-family: arial; font-size: 14pt; color: Snow; background-color: RosyBrown;"> First Name: <SPAN STYLE="color:00ff7f"> <SCRIPT> document.write(sFirstName); </SCRIPT> </SPAN> <BR> Last Name: <SPAN STYLE="color:00ff7f"> <SCRIPT> document.write(sLastName); </SCRIPT> </SPAN> </BODY> </HTML>
Build date: 2/14/2012
I am trying to close a modal dialog window and redirect the parent to another page using the following code:
function
fnCloseWindow(){self.close();
var oParentWindow = window.dialogArguments;
oParentWindow.opener.location.href = 'default.aspx';
returntrue;
}
This function I am calling in the click event of a button in the code behind as below
string
strScript = @"<script language='javascript' type='text/javascript'>";strScript += "fnCloseWindow();";
strScript += @"</script>";
ClientScript.RegisterClientScriptBlock(typeof(Page), "onClick", strScript);
Everything works fine in IE7. In IE6 the modal dialog closes but does not redirect to default.aspx page.
Any help is appreciated.