ASP.NET中画面传值问题
我有一个画面1.aspx,里面有一个textbox和button
我在button事件中添加下面事件:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = "aaaa "
End Sub
然后把这个画面提交到下一个画面2.aspx
<asp:Button ID= "Button1 " runat= "server " Text= "Button " PostBackUrl = "~/2.aspx " />
为什么我在下一个画面(2.aspx)中用request.form( "textbox1 ")获取不了上一个画面的值呢?
我在1.aspx中的text框输入值,下个画面就能获取值.但是为什么就不能在click事件中给textbox付值后下个画面就不能接收呢?
------解决方案--------------------default.aspx
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = "hello wyp "
End Sub
Result.aspx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim prvPage As Page = Page.PreviousPage
Response.Write(CType(prvPage.FindControl( "textbox1 "), TextBox).Text)
End Sub