求助:页面间值的传递
求助:页面间值的传递
编译器错误信息: BC30002: 未定义类型“NewFile624”。
源错误:
行 6: ' Insert page code here
行 7:
行 8: Public TargetPage As NewFile624
行 9:
行 10: Sub page_load(Source As Object,E As Eventargs)
下为两文个件代码:
NewFile624.aspx:
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
Public ReadOnly Property Name() As String
Get
Return TxtName.Text
End Get
End Property
Public ReadOnly Property Password() As String
Get
Return TxtPwd.Text
End Get
End Property
Sub BtnOK_Click(sender As Object, e As EventArgs)
Server.Transfer("Target.aspx")
End Sub
</script>
<html>
<head>
</head>
<body>
<form id="Form1" method="post" runat="server">
<p>
</p>
<p id="Label1" align="center">
<asp:Label id="Label1" runat="server">页面间值传递</asp:Label>
</p>
<p align="center">
<asp:Label
id="Label2"
runat="server">Name:</asp:Label> <asp:TextBox
id="TxtName" runat="server"></asp:TextBox>
</p>
<p align="center">
<asp:Label id="Label3" runat="server">Password:</asp:Label>
<asp:TextBox id="TxtPwd" runat="server"></asp:TextBox>
</p>
<p align="center">
<asp:Button id="BtnOK" onclick="BtnOK_Click" runat="server" Text="确定"></asp:Button>
</p>
<!-- Insert content here -->
</form>
</body>
</html>
Target.aspx:
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
Public TargetPage As NewFile624
Sub page_load(Source As Object,E As Eventargs)
If Not IsPostBack Then
TargetPage = CType(context.Handler, NewFile624)
Message.Text &= "姓 名: <b><Font color = #C00000>" & _
TargetPage.Name & _
"</FONT></b><br>"
Message.Text &= "年 龄: <b><Font color = #C00000>" & _
TargetPage.Password & _
"</FONT></b><br>"
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Message" runat="server"></asp:Label>
<!-- Insert content here -->
</form>
</body>
</html>
[此贴子已经被作者于2007-6-25 18:27:00编辑过]