R
RipperT
College newbie here (Instructor MIA). I have instructions to pass variable
values from one web page to another like this (VS2005):
1. Declare and create the properties on the first page (source form):
Public ReadOnly Property UserName() As String
Get
Return userNameTextBox.Text
End Get
End Property
2. Call the next page by calling the Transfer method of the Server object:
Private Sub pageTwoButton_Click(...)
Server.Transfer("secondWebForm.aspx")
End Sub
3. In the Page_Load event of the second page, create an instance of the
source page and retrieve the property values from the instance:
Public originalPage As WebForm
Private userName As String
Private Sub Page_Load(...)
If Not IsPostBack() Then
originalPage = CType(Context.Handler, firstWebForm)
userName = originalPage.UserName 'Retrieve the value
userLabel.Text = userName 'Preserve for future postbacks
End If
End Sub
Question: How is 'Public originalPage As WebForm' a declaration of an
instance of the first page? I can't even find WebForm as a valid type
declaration.
Many thanx,
Rip
values from one web page to another like this (VS2005):
1. Declare and create the properties on the first page (source form):
Public ReadOnly Property UserName() As String
Get
Return userNameTextBox.Text
End Get
End Property
2. Call the next page by calling the Transfer method of the Server object:
Private Sub pageTwoButton_Click(...)
Server.Transfer("secondWebForm.aspx")
End Sub
3. In the Page_Load event of the second page, create an instance of the
source page and retrieve the property values from the instance:
Public originalPage As WebForm
Private userName As String
Private Sub Page_Load(...)
If Not IsPostBack() Then
originalPage = CType(Context.Handler, firstWebForm)
userName = originalPage.UserName 'Retrieve the value
userLabel.Text = userName 'Preserve for future postbacks
End If
End Sub
Question: How is 'Public originalPage As WebForm' a declaration of an
instance of the first page? I can't even find WebForm as a valid type
declaration.
Many thanx,
Rip