Solution needing ViewState?

R

Random

I would like to do a Server.Transfer from a page where I have a peice of
information saved in ViewState. I have a second peice of information that
is in the Forms collection from a form submit. I perform the
Server.Transfer with the option to keep the forms collection available on
the next page.

I get to the new page, however, and the ViewState is empty and the submitted
value is gone. I really don't want to put my information in the QueryString
or do a Response.Redirect. What am I doing wrong?
 
S

Steve C. Orr [MVP, MCSD]

Here's a reasonably simple solution.
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Alternately, here's a technique for referencing the previous page more
directly:
http://authors.aspalliance.com/kenc/passval.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Needing Help With My First JavaScript script 1
Missing Viewstate 14
viewstate 0
ViewState and DataTable 1
AJAX vs. ViewState? 1
Viewstate Question 6
Viewstate and mobile clients 0
UserControl and ViewState Error 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top