如何點擊按鈕彈出新窗口,輸入數據後返回並刷新頁面?(2)

WebForm3.aspx

  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb"
  2.  Inherits="ShowModalDialog.WebForm3" %>
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  4. <HTML>
  5.   <HEAD>
  6.    <title>WebForm3</title>
  7.    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
  8.    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
  9.    <meta name="vs_defaultClientScript" content="JavaScript">
  10.    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">        
  11.   </HEAD>
  12.   <body MS_POSITIONING="GridLayout" id="MyBody" runat="server">
  13.   <form id="Form1" method="post" runat="server">
  14.    <asp:Label id="Label1" runat="server">請輸入您的大名:</asp:Label><br>
  15.    <br>
  16.    <asp:TextBox id="TextBox1" runat="server" Width="558"></asp:TextBox><br>
  17.    <br>
  18.    <asp:Button id="Button1" runat="server" Text=" 提  交 "></asp:Button>
  19.   </form>
  20.   </body>
  21. </HTML>

 WebForm2.aspx.vb

 

  1. Public Class WebForm2
  2.     Inherits System.Web.UI.Page
  3. #Region " Web 窗體設計器生成的代碼 "
  4.   '該調用是 Web 窗體設計器所必需的。
  5.   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  6.   End Sub
  7.   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  8.     'CODEGEN: 此方法調用是 Web 窗體設計器所必需的
  9.     '不要使用代碼編輯器修改它。
  10.     InitializeComponent()
  11.   End Sub
  12. #End Region
  13.   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  14.     '在此處放置初始化頁的用戶代碼
  15.   End Sub
  16. End Class

 

WebForm3.aspx.vb

 

Public Class WebForm3   Inherits System.Web.UI.Page   Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox   Protected WithEvents Label1 As System.Web.UI.WebControls.Label   Protected WithEvents Button1 As System.Web.UI.WebControls.Button   Protected MyBody As System.Web.UI.HtmlControls.HtmlControl #Region " Web 窗體設計器生成的代碼 "   '該調用是 Web 窗體設計器所必需的。   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()   End Sub   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init     'CODEGEN: 此方法調用是 Web 窗體設計器所必需的     '不要使用代碼編輯器修改它。     InitializeComponent()   End Sub #End Region   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load     '在此處放置初始化頁的用戶代碼     If IsPostBack Then       Dim strScript As String = "<script>" + vbCrLf       strScript += "window.parent.returnValue='" + TextBox1.Text.Replace("'""/'") + "'" + vbCrLf       strScript += "window.parent.close()" + vbCrLf       strScript += "</script>" + vbCrLf       If (Not IsClientScriptBlockRegistered("clientScript")) Then         RegisterClientScriptBlock("clientScript", strScript)       End If     End If     If Not IsPostBack Then       MyBody.Attributes.Add("onload""document.Form1.TextBox1.value=window.parent.dialogArguments")     End If   End Sub End Class

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章