Application of modal window

Source: Internet
Author: User

/// 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

}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.