文件a.aspx
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Label ID="Label2" runat="server"></asp:Label>
<asp:Button ID="Button2" runat="server" Text="显示" /></div>
文件b.aspx.vb
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If Not Page.PreviousPage Is Nothing Then
Dim SourceTextBox As TextBox
SourceTextBox = CType(PreviousPage.FindControl("TextBox2"), TextBox)
If Not SourceTextBox Is Nothing Then
Label2.Text = SourceTextBox.Text
End If
End If End Sub为什么什么都显示不出来?
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Label ID="Label2" runat="server"></asp:Label>
<asp:Button ID="Button2" runat="server" Text="显示" /></div>
文件b.aspx.vb
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If Not Page.PreviousPage Is Nothing Then
Dim SourceTextBox As TextBox
SourceTextBox = CType(PreviousPage.FindControl("TextBox2"), TextBox)
If Not SourceTextBox Is Nothing Then
Label2.Text = SourceTextBox.Text
End If
End If End Sub为什么什么都显示不出来?
解决方案 »
- DropDownList 选择新闻类别,点listView下一页时怎么又类别错乱了呢
- [求助]如何統計打印次數?(歡迎幫頂)
- 用字符串表示控件名
- 奇怪的问题
- dataadapter.update()的问题,怎么不行呢??
- 各位有经验的大哥,小弟现在要实现asp.net的注册码程序,请大哥给与指点,多谢了,奉上50分
- 请问大家做文章录入的页面时,用的什么控件
- 各位同仁谁能给我发几个asp.net2005工作流的例子啊?(万分感谢)
- WebGrid控件能够让让数据集旋转90°绑定吗?
- 关于databind问题
- .net可不可以实现文件无后缀名的效果???
- 为什么输入正确的用户名与密码也无法登录???
第一次
Page_Load()
点击Button_Click之后是
Page_load()//注意,在这个时候,你的TextBox的Text已经清空了
Button_Click()//所以这里获取不到值
Codebehind="b.aspx.vb"
这个主要是学习PreviousPage.FindControl的用法
我是。NET初学,很高兴认识大家!
我没这么用过,PreviousPage似乎用于crosspage postback. 为什么不直接写
Label2.Text = SourceTextBox.Text呢。