asp.net data between pages through scripts

Source: Internet
Author: User
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.



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.