Accessing Viewstate in dynamic user controls...

G

Guest

Ok. Here is the question. I am writing code to make a multipage form. Each
page is loaded from a usercontrol. Now when I get to the final page I would
like to access the information on the first page. But I can't seem to find a
way to access the current data. I can access the control, but it gives me
the default data. Not the data in the Viewstate. I know that view states is
working because when I use the navigation buttons to go back to the pages the
data is still in the fields. Any help would be much appreciated. Below is a
brief Layout of the code.

Forms.aspx
|_
|
Place holder
|
Step 0 user control -- Hidden
Step 1 user control -- Hidden
Step 2 user control -- Visible trying to retrieve data from Step 0
Control
 
G

Guest

nvm. I found the answer. I needed to move my LoadControls function from the
Page_Load event to the OnInit event. Once I did that I can access all of the
fields.
 
G

Guest

You didn't state if you're using VS.Net or not, but if you are, do yourself a
favor and put your init code into a separate function, and call that function
from Page_OnInit. VS.Net likes to rewrite the entire "Web Designer" section
whenever you pop in & out of the designer view, so there's a chance you might
lose your changes. So, better off maybe losing one line of code than losing
many, you know?
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top