How do I click the button to bring up a new window, enter the data, return to and refresh the page?

Source: Internet
Author: User

& Lt; % @ Page Language = & quot; vb & quot; AutoEventWireup = & quot; false & quot; Codebehind = & quot; WebForm1.aspx. vb & quot; Inherits = & quot; ShowModalDialog. webForm1 & quot; % & gt; & lt ;! Doctype html public & quot;-// W3C // dtd html 4.0 Transitional // EN & quot; & gt; & lt; HTML & gt; & lt; HEAD & gt; & lt; title & gt; WebForm1 & lt;/title & gt; & lt; meta content = & quot; Microsoft Visual Studio. NET 7.0 & quot; name = & quot; GENERATOR & quot; & gt; & lt; meta content = & quot; Visual Basic 7.0 & quot; name = & quot; CODE_LANGUAGE & quot; & gt; & lt; meta content = & quot; JavaScript & quot; name = & quot; vs_defaultClientScript & quot; & gt; & lt; meta content = & quot; http://schemas.microsoft.com/intellisense/ie5&quot ; Name = & quot; vs_targetSchema & quot; & gt; & lt;/HEAD & gt; & lt; body MS_POSITIONING = & quot; GridLayout & quot; & gt; & lt; div align = & quot; center & quot; & gt; & lt; form id = & quot; Form1 & quot; method = & quot; post & quot; runat = & quot; server & quot; & gt; & lt; asp: label id = & quot; Label1 & quot; runat = & quot; server & quot; Font-Bold = & quot; true & quot; & gt; the example of opening a new window from the current page and passing the variable to the new window can be opened and submitted multiple times. & Lt;/asp: label & gt; & lt; br & gt; & lt; asp: textbox id = & quot; TextBox1 & quot; runat = & quot; server & quot; Width = & quot; 600px & quot; & gt; this is the initial value and will be passed to the new window. & Lt;/asp: textbox & gt; & lt; br & gt; & lt; asp: button id = & quot; Button1 & quot; runat = & quot; server & quot; Text = & quot; open the window & quot; Width = & quot; 96px & quot; & gt; & lt;/asp: button & gt; & lt;/form & gt; & lt;/div & gt; & lt;/body & gt; & lt;/HTML & gt;

WebForm1.aspx. vb

Public Class WebForm1Inherits System. web. UI. pageProtected WithEvents TextBox1 As System. web. UI. webControls. textBoxProtected WithEvents Form1 As System. web. UI. htmlControls. htmlFormProtected WithEvents Label1 As System. web. UI. webControls. labelProtected WithEvents Button1 As System. web. UI. webControls. button # Region & quot; code generated by the Web Form Designer & quot; 'This call is required by the Web form designer. & Lt; System. diagnostics. debuggerStepThrough () & gt; Private Sub InitializeComponent () End SubPrivate Sub Page_Init (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. init 'codegen: This method is required by the Web forms designer. 'do not use the code editor to modify it. InitializeComponent () End Sub # End RegionPrivate Sub Page_Load (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. load' user code where the initialization page is placed If (Not IsClientScriptBlockRegistered (& quot; clientScript & quot;) ThenDim strScript As String = & quot; & lt; script & gt; & quot; + vbCrLfstrScript ++ = & quot; function OpenWin () {& quot; + vbCrLfstrScript ++ = & quot; var str = window. showModalDialog ('webform2. asp X', document. Form1.TextBox1. value) & quot; + vbCrLfstrScript ++ = & quot; if (str! = Null) document. form1.TextBox1. value = str & quot; + vbCrLfstrScript + = & quot;} & quot; + vbCrLfstrScript + = & quot; & lt;/script & gt; & quot; + vbCrLfRegisterClientScriptBlock (& quot; clientScript & quot;, strScript) End IfButton1.Attributes. add (& quot; onclick & quot;, & quot; OpenWin () & quot;) End SubEnd Class

WebForm2.aspx

& Lt; % @ Page Language = & quot; vb & quot; AutoEventWireup = & quot; false & quot; Codebehind = & quot; WebForm2.aspx. vb & quot; Inherits = & quot; aspxWeb.mengxianhui.com. webForm2 & quot; % & gt; & lt ;! Doctype html public & quot;-// W3C // dtd html 4.0 Transitional // EN & quot; & gt; & lt; HTML & gt; & lt; HEAD & gt; & lt; title & gt; WebForm2 & lt;/title & gt; & lt; meta name = & quot; GENERATOR & quot; content = & quot; Microsoft Visual Studio. NET 7.0 & quot; & gt; & lt; meta name = & quot; CODE_LANGUAGE & quot; content = & quot; Visual Basic 7.0 & quot; & gt; & lt; meta name = & quot; vs_defaultClientScript & quot; content = & quot; JavaScript & quot; & gt; & lt; meta name = & quot; vs_targetSchema & quot; content = & quot; http://schemas.microsoft.com/intellisense/ie5"></HEAD><frameset Rows = & quot; 0, * & quot; & gt; & lt; frame src = & quot; about: blank & quot; & gt; & lt; frame src = & quot; WebForm3.aspx & quot; & gt; & lt;/frameset & gt; & lt;/HTML & gt;

WebForm2.aspx. vb

Public Class WebForm2Inherits System. Web. UI. Page # Region & quot; code generated by the Web forms Designer & quot; 'This call is required by the Web forms designer. & Lt; System. diagnostics. debuggerStepThrough () & gt; Private Sub InitializeComponent () End SubPrivate Sub Page_Init (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. init 'codegen: This method is required by the Web forms designer. 'do not use the code editor to modify it. InitializeComponent () End Sub # End RegionPrivate Sub Page_Load (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. load' the user code End SubEnd Class where the initialization page is placed

WebForm3.aspx

& Lt; % @ Page Language = & quot; vb & quot; AutoEventWireup = & quot; false & quot; Codebehind = & quot; WebForm3.aspx. vb & quot; Inherits = & quot; ShowModalDialog. webForm3 & quot; % & gt; & lt ;! Doctype html public & quot;-// W3C // dtd html 4.0 Transitional // EN & quot; & gt; & lt; HTML & gt; & lt; HEAD & gt; & lt; title & gt; WebForm3 & lt;/title & gt; & lt; meta name = & quot; GENERATOR & quot; content = & quot; Microsoft Visual Studio. NET 7.0 & quot; & gt; & lt; meta name = & quot; CODE_LANGUAGE & quot; content = & quot; Visual Basic 7.0 & quot; & gt; & lt; meta name = & quot; vs_defaultClientScript & quot; content = & quot; JavaScript & quot; & gt; & lt; meta name = & quot; vs_targetSchema & quot; content = & quot; http://schemas.microsoft.com/intellisense/ie5"></HEAD><body MS_POSITIONING = & quot; GridLayout & quot; id = & quot; MyBody & quot; runat = & quot; server & quot; & gt; & lt; form id = & quot; form1 & quot; method = & quot; post & quot; runat = & quot; server & quot; & gt; & lt; asp: Label id = & quot; Label1 & quot; runat = & quot; server & quot; & gt; enter your name: & lt;/asp: Label & gt; & lt; br & gt; & lt; br & gt; & lt; asp: TextBox id = & quot; TextBox1 & quot; runat = & quot; server & quot; Width = & quot; 558 & quot; & gt; & lt;/asp: TextBox & gt; & lt; br & gt; & lt; asp: Button id = & quot; Button1 & quot; runat = & quot; server & quot; Text = & quot; Submit & quot; & gt; & lt;/asp: Button & gt; & lt;/form & gt; & lt;/body & gt; & lt;/HTML & gt;

WebForm3.aspx. vb

Public Class WebForm3Inherits System. web. UI. pageProtected WithEvents TextBox1 As System. web. UI. webControls. textBoxProtected WithEvents Label1 As System. web. UI. webControls. labelProtected WithEvents Button1 As System. web. UI. webControls. buttonProtected MyBody As System. web. UI. htmlControls. htmlControl # Region & quot; code generated by the Web Form Designer & quot; 'This call is required by the Web form designer. & Lt; System. diagnostics. debuggerStepThrough () & gt; Private Sub InitializeComponent () End SubPrivate Sub Page_Init (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. init 'codegen: This method is required by the Web forms designer. 'do not use the code editor to modify it. InitializeComponent () End Sub # End RegionPrivate Sub Page_Load (ByVal sender As System. object, ByVal e As System. eventArgs) Handles MyBase. load 'user code where the initialization page is placed If IsPostBack ThenDim strScript As String = & quot; & lt; script & gt; & quot; + vbCrLfstrScript + = & quot; window. parent. returnValue = '& quot; + TextBox1.Text. replace (& quot; '& quot;, & quot; \' & quot;) + & quot; '& quot; + vbCrLfstrScript + = & quot; window. parent. close () & quot; + vbCrLfstrScript + = & quot; & lt;/script & gt; & quot; + vbCrLfIf (Not IsClientScriptBlockRegistered (& quot; clientScript & quot ;)) thenRegisterClientScriptBlock (& quot; clientScript & quot;, strScript) End IfEnd IfIf Not IsPostBack ThenMyBody. attributes. add (& quot; onload & quot;, & quot; document. form1.TextBox1. value = window. parent. dialogArguments & quot;) End IfEnd SubEnd Class

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.