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

Accessing Viewstate in dynamic user controls...

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


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

"LarryB" wrote:
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

Nov 18 '05 #2

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

---
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://blogs.squaretwo.net

"LarryB" wrote:
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.

"LarryB" wrote:
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

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.