Two pages Code As follows:
Page. aspx (parent form) < Html >
< Body >
< Script Language = " C # " Runat = " Server " >
</ Script >
< Form ID = " Form1 " Method = Post runat = " Server " >
< ASP: textbox ID = Txtname runat = Server > </ ASP: textbox >
< Input type = Button Value = " Dialog Box " Onclick = " Mywin = Window. Open ('subpage. aspx '); " >
</ Form >
</ Body >
</ Html >
Subpage. aspx (subform) < Html >
< Body >
< Script Language = " Javascript " >
Function Popup ()
{
Zookeeper opener.doc ument. All [ " Txtname " ]. Value = Document. All [ " Txtsubname " ]. Value;
Window. Close ()
}
</ Script >
< Script Language = " C # " Runat = " Server " >
</ Script >
< Form ID = " Form1 " Method = Post runat = " Server " >
< ASP: textbox ID = Txtsubname runat = Server > </ ASP: textbox >
< P > < Input type = " Button " Value = " Pass the value and return to the parent window " Name = " Button1 " Onclick = " Popup () " > </ P >
</ Form >
</ Body >
</ Html >
Notes:
1. The child form is displayed. the textbox value of the child form is passed to the parent form.
2. Both buttons use HTML controls or can be replaced with server controls of Asp.net. As for how to call JScript by server controls, here is a tip: execute such code in the button_click event.StringScript="<Script language = "JavaScript"> window. Open ('subpage. aspx '); </SCRIPT>"
Response. Write (SCRIPT );
In this way, the JavaScript code is executed.