Close the modal window and refresh the parent window

Source: Internet
Author: User

How to make good use of the modal window has always been a difficult place for me. Recently, a project was launched, in which the modal window was used to complete the data adjustment task. The following describes how to use the modal window.

A. aspx

<Br/> <! -- Introduce jquery --> <br/> <MCE: script src = "jquery. JS "mce_src =" jquery. JS "type =" text/JavaScript "> </MCE: SCRIPT> <br/> <MCE: script language =" JavaScript "type =" text/JavaScript "> <! -- <Br/> var uppic = function (ID) {<br/> var K = showmodaldialog (B. aspx? Newsid = '+ id, "", "dialogwidth: 400px; center: Yes; dialogheight: 80px; help: No; scroll: No; Status: No "); <br/> If (k = 1) {window. location. href = Window. location. href ;}; <br/>}< br/> // --> </MCE: SCRIPT> </P> <p> </pead> <br/> <body> <br/> <p onclick = "uppic (1) "> click my pop-up window </P> <br/> </body> <br/> </ptml>

Key of the above Code: var K = Module window code; If (k = 1) {window. Location. href = Window. Location. href ;}

B. aspx

<! -- Only list key code. aspx --> <br/> <meta http-equiv = "Pragma" content = "no-Cache"> <br/> <meta http-equiv = "cache-control" content = "no-cache, must-revalidate "> <br/> <pead> <br/> <base target =" _ Self "> <br/> </pead> <br/> <body> <br/> <asp: button id = "btnuploadpic" runat = "server" text = "Upload" onclick = "btnuploadpic_click"/> <br/> </body>

Key points of the above Code: <base target = "_ Self">

 

B. CS

 

Protected void btnuploadpic_click (Object sender, eventargs e) <br/>{< br/> response. Write ("<MCE: Script Type =" text/JavaScript "> <! -- <Br/> alert ('upload succeeded '); window. returnvalue = 1; window. close (); <br/> // --> </MCE: SCRIPT> "); <br/> // refresh page <br/> // scriptmanager. registerstartupscript (updatepanel1, this. getType (), "onclick", "window. returnvalue = 1; window. close (); ", true); // close some modal windows. The return value is 1 </P> <p>}

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.