asp.net| Script | data | Page Create a new WebForm1.aspx page, add a TextBox and a button control, and write a statement that registers client script in the Page_Load of the page:
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
if (! Page.isclientscriptblockregistered ("ClientScript"))
{
StringBuilder sbscript = new StringBuilder ();
Sbscript.append ("<script>\n");
Sbscript.append ("function Openwin () {\ n");
Sbscript.append ("var str=window.showmodaldialog" (' webform2.aspx '), document. Form1.txtWndName.value) \ n ");
Sbscript.append ("if (str!=null) document." Form1.txtwndname.value=str\n ");
Sbscript.append ("}\n</script>\n");
string script = Sbscript.tostring ();
RegisterClientScriptBlock ("ClientScript", script);
}
THIS.BTNOPEN.ATTRIBUTES.ADD ("OnClick", "Openwin ()");
}
Create a new webform2.aspx page, put in two frames:
<frameset rows= "0,*" >
<frame src= "About:blank"
<frame src= "Webform3.aspx" >
</frameset>
Create a new webform3.aspx page, and write down the statement in the Page_Load that registers the script:
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
if (Page.IsPostBack)
{
StringBuilder sbscript = new StringBuilder ();
Sbscript.append ("<script>\n");
Sbscript.append ("window.parent.returnvalue= '" + this.) TextBox1.Text + "' \ n");
Sbscript.append ("Window.parent.close () \ n");
Sbscript.append ("</script>\n");
string script = Sbscript.tostring ();
if (! Page.isclientscriptblockregistered ("ClientScript"))
{
RegisterClientScriptBlock ("ClientScript", script);
}
}
}
Data passing through JavaScript pop-up windows.