Modal window drip

Source: Internet
Author: User

1. Opening of the modal window, model window open
2. Close the modal window. Close the model window.
3. Transfer Parameters of the modal window, model window get valuse
4. Other..., other ..

1. window. showmodaldialog ("dialogpage. aspx "," newwin "," dialogheight: 200px; dialogwidth: 150px; dialogtop: 458px; dialogleft: 166px; edge: raised; center: Yes; help: Yes; resizable: yes; status: Yes ;");

2. Window. Close ();

3. Pass the value
Parentpage. aspx:
Window. showmodaldialog ("dialogpage. aspx? Para1 = aaa & para2 = BBB ");

Dialogpage. aspx:
String str1 = request. querystring ["para1"]. tostring ();
String str2 = request. querystring ["para2"]. tostring ();

Return Value
Dialogpage. aspx:
Window. returnvalue = "AAA"; // return aaa

Parentpage. aspx:
VaR STR = Window. showmodaldialog ("dialogpage. aspx"); // the return value of the modal window is AAA.

In actual application, the following events may be displayed:

// Determine the event handler
Private   Void Ibtnok_click ( Object Sender, system. Web. UI. imageclickeventargs E)
{
Datatable dt = Parameters. parametertable;
String Name = Parameters. strtablename;
String Strsearch = "" ;

// Return splicing parameter conditions
Strsearch = Returnparavalues (DT );
If (Strsearch ! = "" )
{
Strsearch="And 1 = 1"+Strsearch;
}

// Execute JavaScript scripts
Stringbuilder sb =   New Stringbuilder ();
If ( ! This . Page. isclientscriptblockregistered ( " Goexactsearchview " ))
{
SB. append ( " <Script language = 'javascript '> \ n " )
. Append ( " Window. returnvalue = " ). Append ( " Window. dialogarguments + \ "   " + Strsearch). append ( " \ " ; \ N " )
. Append ( " Window. Close (); \ n " )
. Append ( " </SCRIPT> \ n " );
This . Page. registerclientscriptblock ( " Goexactsearchview " , SB. tostring ());
}
}

AboveProgramAn example of monitoring during runtime is as follows:

Strsearch = "and 1 = 1 and tempcolumn63467 like '% CKD Cummins c300 20 (eu ii) % '"

< Script Language = 'Javascript' >
Window. returnvalue=Window. dialogarguments+"And 1 = 1 and tempcolumn63467 like '% CKD Cummins c300 20 (eu ii) %'";
Window. Close ();
</ Script >
<! -- Note the role of window. dialogarguments: -->

In this way, when you click submit, the processed result strsearch will be returned! And the modal page is automatically closed!
The parent page is processed as follows:

 

// Open the parameter filtering window in mode Feng Yan 2007-04-23 e-Works
Function Openparalistwin (URL, strargs, cetvaluectlid)
{
Document. getelementbyid ( " Iframesearch " ). SRC = URL;
Document. getelementbyid ( " Iframesearch " ). Style. Display =   " Inline " ;
VaR Resultvalue = Window. showmodaldialog (URL, strargs, 'dialogwidth = 500px; dialogheight = 500px; help: No; Status: No ;');
/**/ /*Note that the second parameter, strargs, is used to return this parameter to the current page after the modal window is opened. the dialogarguments attribute is used to obtain the strargs value! This method is sometimes better than passing parameters in the URL! However, window. dialogarguments is only applicable to the mode and modeless windows.*/
If (Resultvalue ! = Undefined)
{
// Window. Alert (resultvalue );
Document. getelementbyid (cetvaluectlid). Value = Resultvalue; // Processing modal window return values
Document. getelementbyid ('form1'). Submit (); // Automatically submit this ASPX page to update the result!
}
Return   False ;
}

The above JS function is also the response for processing events when a button click is clicked in the parent window! If a result is returned, this page is automatically updated!

4.
Why does the ASPX page reopen a page when showmodeldialog is submitted?
On the showmodaldialog page, add a line between

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.