/// Modal window Definition
/// <Summary>
/// For humorous cache reasons, if you modify the data in the modal window, you will find that the data on the parent page is refreshed, but when you click the button again,
/// When the modal window is popped up again, you will find that the content in the modal window is still the content of the previous time. After my experiment, after manually modifying the HTML code,
/// Click the pop-up modal window or the same page is displayed. Therefore, we need to bypass this mechanism by adding random parameters after the pop-up ASPX page.
/// The above modal window code can be changed to the following to avoid this problem:
/// </Summary>
/// <Param name = "openaspxpage"> </param>
/// <Param name = "width"> </param>
/// <Param name = "height"> </param>
/// <Returns> </returns>
Public String modalwindownocache (string openaspxpage, int width, int height)
{
String JS = string. format ("javascript: window. showmodaldialog (/"{0} & Rand =" + new random (). next (). tostring () + "/", window,/"status: false; dialogwidth: {1} PX; dialogheight: {2} Px/") ", openaspxpage, width, height );
Return JS;
}
/// <Summary>
/// Close the child form and refresh the parent form
/// </Summary>
/// <Returns> </returns>
Public static string refreshparentwin (){
Stringbuilder JS = new stringbuilder ();
JS. append ("<script language =/" javascript/"> ");
JS. append ("window. dialogarguments. Location. href = Window. dialogarguments. Location. href; window. Focus (); window. Close ();");
JS. append ("</SCRIPT> ");
Return Js. tostring ();
}
In the modal window, use incluincludialogarguments.doc ument. getelementsbyid () to obtain the data window. returnvalue = rolenamear in the parent form. array data is returned to the parent form.
VaR Dia = <% = modalwindownocache () %> in the parent form dialog box
If (! DIA ){
// Obtain the data returned by the modal window
}