Hobbes Posted May 22, 2003 Posted May 22, 2003 Hello. I am a newbie in ASP.net. I am learning it own my own and faces many problems, even with 3 books. My Question: Is there a way to pass variables between pages and display the information on another page? I am trying to allow user to enter a message in a textbox and then display it on another page before e-mailling it to me. Thanks! :confused: Quote Hobbes...
evaleah Posted May 22, 2003 Posted May 22, 2003 You have several choices in how to do that. The first is to append it to your redirect call as a query string and then retrieve the value. Public Class Page1 Dim searchParams as string Private Sub GoToPage2() searchParams = "Param1=" & httputility.urlencode(MyTextbox.Text) searchParams += "&Param2=" & httputility.urlencode(Textbox2.Text) response.redirect("Page2.aspx?" & searchParams End Sub End Class Public Class Page2 Private Sub GetValue() NewTextBox.Text = request.Params("Param1") NewTextBox2.Text = request.params("Param2") End Sub End Class Or pass the value as explained in: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskpassingvaluesbetweenwebformspages.asp Two ideas are enough. Though, I would recommend the first anway. Eva Quote
Hobbes Posted May 22, 2003 Author Posted May 22, 2003 Thanks Eva. You are a great help! Love this Forum!!! :) Quote Hobbes...
Moderators Robby Posted May 22, 2003 Moderators Posted May 22, 2003 Method 2 comes in handy if you're not using response.redirect(), especially if you want to pass objects from page to page and not just strings. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.