Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
#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 (Not IsClientScriptBlockRegistered("clientScript")) Then
Dim strScript As String = "<script>" + vbCrLf
strScript += "function OpenWin(){" + vbCrLf
strScript += "var str=window.showModalDialog('WebForm2.aspx',document.Form1.TextBox1.value)" + vbCrLf
strScript += "if(str!=null) document.Form1.TextBox1.value=str" + vbCrLf
strScript += "}" + vbCrLf
strScript += "</script>" + vbCrLf
RegisterClientScriptBlock("clientScript", strScript)
End If
Button1.Attributes.Add("onclick", "OpenWin()")
End Sub