Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

Hobbes...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...