Reputation: 883
on my website I have an "Enroll" page where users submit some basic information, there's some basic validation on that page then the user is taken to an "Enrollment Confirmed" page (which i don't want to display the info from previous page). On the confirmation page there is link to a "Print Enrollment Confirmation" page which, on this page, I want to contain the information entered from the "Enroll" page. So basically, I want the input entered on "Page 1" put into labels on "Page 3". I've seen some examples of transferring information from "Page 1" to "Page 2" but I have an extra page users need to go through before hitting the page with their previously entered data.
Can someone give me an explanation on how I could do this without using query strings? Thank you.
Upvotes: 1
Views: 929
Reputation: 5499
You could create an class with properties for each form field then store it in the session. Then after you populate what you need on page 3 remove it from the session.
Example
Class:
<Serializable()>
Public Class Input
Private _FirstName As String = String.Empty
Private _LastName As String = String.Empty
Public Property FirstName As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
_FirstName = value
End Set
End Property
Public Property LastName As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
_FirstName = value
End Set
End Property
Public Sub New()
End Sub
End Class
Storing data:
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim FormData As New Input()
FormData.FirstName = txtFirstName.Text
FormData.LastName = txtLastName.Text
Session("InputData") = FormData
End Sub
Retrieving it:
If Not IsNothing(Session("InputData")) Then
Dim FormData As Input = DirectCast(Session("InputData"), Input)
txtFirstName.Text = FormData.FirstName
txtLastName.Text = FormData.LastName
Session.Remove("InputData")
End If
Upvotes: 4
Reputation: 11
I would store the values in hidden input fields on page 2 and if page 3 is called as a form submit, then the values will be available through Request.Form.
Upvotes: 0
Reputation: 46839
This pretty much sums up your choices:
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
Upvotes: 0
Reputation: 50728
You could use the button.postbackurl property to post the data to another page:
http://msdn.microsoft.com/en-us/library/ms178140.aspx
In the intermediary pages, you could store the data in hidden fields from page 1, so the data would be in the posted results for page 3, when another button posts the data from page 2 to page 3.
HTH.
Upvotes: 1