Transfer Data between Asp.net pages through scripts

Source: Internet
Author: User

Create a WebForm1.aspx page, add a TextBox and a Button control, and write the statement for registering the client script in Page_Load:
Private void Page_Load (object sender, System. EventArgs e)
{
// Place user code here to initialize the page
If (! Page. IsClientScriptBlockRegistered ("clientScript "))
{
StringBuilder sbScript = new StringBuilder ();
SbScript. Append ("<script> ");
SbScript. Append ("function OpenWin (){");
SbScript. Append ("var str={{showmodaldialog('webform2.aspx', document.form1.txt WndName. value )");
SbScript. Append ("if (str! = Null) document.Form1.txt WndName. value = str ");
SbScript. Append ("} </script> ");
String script = sbScript. ToString ();
RegisterClientScriptBlock ("clientScript", script );
}
This. btnOpen. Attributes. Add ("OnClick", "OpenWin ()");
}
Create a WebForm2.aspx page and put it in two frameworks:
<Frameset rows = "0, *">
<Frame src = "about: blank"
<Frame src = "WebForm3.aspx">
</Frameset>
Create a WebForm3.aspx page and write the script registration statement in Page_Load:
Private void Page_Load (object sender, System. EventArgs e)

Related Article

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.