I. Obtain the pop-up window value from the parent page Js.
This page uses a textbox to receive the passed value.
<Input id = "text1" type = "text" onclick = "show ();" runat = "server"/>
Function show ()
{
VaR result = Window. showmodaldialog ("Top. aspx", null, "dialogwidth: 350px; dialogheight: 350px; help: No; Status: No ");
If (result)
{
VaR A = Document. getelementbyid ("text1 ");
A. value = result;
// Alert (result );
}
Else
{
Alert ('subwindow returns false! ');
}
}
Pop-up page
Add <base target = "_ Self"> </base>
Return Value
String A = "successfully passed the value ";
Response. Write ("<SCRIPT> window. returnvalue = '" + A + "'; window. Close (); </SCRIPT> ");
Ii. Close the pop-up window and refresh the parent page
Parent page
<SCRIPT type = "text/JavaScript">
Function show ()
{
// Method 1 in the pop-up window:
// Window. showmodaldialog ("defa3.3.aspx", null, "dialogwidth: 350px; dialogheight: 350px; help: No; Status: No ");
// Method 2 of the pop-up window:
Window. open ("defa3.3.aspx", null, "toolbar = No, location = No, directories = No, status = No, menubar = No, scrollbars = No, resizable = No, width = 400, Height = 200, Left = 300, Top = 400 ");
/}
</SCRIPT>
Pop-up page
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default3.aspx. cs" inherits = "default3" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> No title page </title>
<Base target = "_ Self"> </base>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
Pop-up page
<Asp: button id = "button2" runat = "server" onclick = "button2_click" text = "button"/> </div>
</Form>
</Body>
</Html>
Code:
Protected void button2_click (Object sender, eventargs E)
{
Response. Write ("<SCRIPT> window. opener. Location. Reload (); window. Close (); </SCRIPT> ");
}
Refresh the framework parent page
Response. Write ("<SCRIPT> window. Open ('err. aspx ',''); window. Parent. Location. Reload (); </SCRIPT> ");