pass the value
-
hi all, i want to pass the text of a textbox in one webform to the text property of a label in another webfor, in the same web application. can anyone tell me. ow it can be done. thanks in advance.
-
hi all, i want to pass the text of a textbox in one webform to the text property of a label in another webfor, in the same web application. can anyone tell me. ow it can be done. thanks in advance.
The easiest way is to store the required value in Session State. WebForm1
Session("MyValue") = FromTextBox.Text
WebForm2If Not Session("MyValue") Is Nothing Then ToLabel.Text = Session("MyValue") End If
You could also get the ViewState information from the original WebForm by using the Server.Transfer method. This method requires that the EnableViewStateMac attribute of the WebForm be set to False so that the ViewState is not hashed. WebForm1Server.Transfer("WebForm2.aspx", True)
WebForm2Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim fromForm As System.Collections.Specialized.NameValueCollection fromForm = Request.Form ToLabel.Text = fromForm.Item("FromTextBox") End Sub