By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

Passing values to another web page

P: n/a
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

Nov 9 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ripper,

I never succeeded to pass to another page. Remember that a page is
stateless, therefore it does not exist anymore on your server as soon as it
is send.

Most people use the long time existing Session.Items for that.

There is as well another method, but for me the Sessions.Item did it the
best.

Cor
"RipperT" <Ri*****@Nowhere.comschreef in bericht
news:ea**************@TK2MSFTNGP03.phx.gbl...
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



Nov 9 '06 #2

P: n/a
Thanks for the response. Our instructions mentioned the use of
Session.Items, but did not include details on how to use it. Can you provide
an example?

Many thanks,

Ripper
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Ripper,

I never succeeded to pass to another page. Remember that a page is
stateless, therefore it does not exist anymore on your server as soon as
it is send.

Most people use the long time existing Session.Items for that.

There is as well another method, but for me the Sessions.Item did it the
best.

Cor
"RipperT" <Ri*****@Nowhere.comschreef in bericht
news:ea**************@TK2MSFTNGP03.phx.gbl...
>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




Nov 9 '06 #3

P: n/a
Ripper,

Just use it, to transport a dataset it is by instance

session.Item("ds") = ds

And to use it in your other page
ds as dataset = DirectCast(session.Item("ds"),DataSet)

Cor

"RipperT @comcast.net>" <rippert<nospamschreef in bericht
news:OR***************@TK2MSFTNGP02.phx.gbl...
Thanks for the response. Our instructions mentioned the use of
Session.Items, but did not include details on how to use it. Can you
provide an example?

Many thanks,

Ripper
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Ripper,

I never succeeded to pass to another page. Remember that a page is
stateless, therefore it does not exist anymore on your server as soon as
it is send.

Most people use the long time existing Session.Items for that.

There is as well another method, but for me the Sessions.Item did it the
best.

Cor
"RipperT" <Ri*****@Nowhere.comschreef in bericht
news:ea**************@TK2MSFTNGP03.phx.gbl...
>>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





Nov 10 '06 #4

P: n/a
Thank you for the help.

Rip

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Ripper,

Just use it, to transport a dataset it is by instance

session.Item("ds") = ds

And to use it in your other page
ds as dataset = DirectCast(session.Item("ds"),DataSet)

Cor

"RipperT @comcast.net>" <rippert<nospamschreef in bericht
news:OR***************@TK2MSFTNGP02.phx.gbl...
>Thanks for the response. Our instructions mentioned the use of
Session.Items, but did not include details on how to use it. Can you
provide an example?

Many thanks,

Ripper
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Ripper,

I never succeeded to pass to another page. Remember that a page is
stateless, therefore it does not exist anymore on your server as soon as
it is send.

Most people use the long time existing Session.Items for that.

There is as well another method, but for me the Sessions.Item did it the
best.

Cor
"RipperT" <Ri*****@Nowhere.comschreef in bericht
news:ea**************@TK2MSFTNGP03.phx.gbl...
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





Nov 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.