您的位置:首页 > 其它

如何点击按钮弹出新窗口,输入数据后返回并刷新页面?(2)

2008-10-17 11:26 1041 查看
WebForm3.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb"

Inherits="ShowModalDialog.WebForm3" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>WebForm3</title>

<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">

<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout" id="MyBody" runat="server">

<form id="Form1" method="post" runat="server">

<asp:Label id="Label1" runat="server">请输入您的大名:</asp:Label><br>

<br>

<asp:TextBox id="TextBox1" runat="server" Width="558"></asp:TextBox><br>

<br>

<asp:Button id="Button1" runat="server" Text=" 提 交 "></asp:Button>

</form>

</body>

</HTML>

WebForm2.aspx.vb

Public Class WebForm2

Inherits System.Web.UI.Page

#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

'在此处放置初始化页的用户代码

End Sub

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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐