Urgent : Dynamic user controls (PLEASE)

J

John

Hi all,

I have posted this type of question quite a few times but to date, no-one
has actually been able to provide me with a solution. I really need to
understand how to do this properly.

My situation:
I have n user controls which, based on user input, interchange with a
placeholder on a web form.

My problem:
Using the LoadControl function, my dynamic user controls are not maintaining
their state upon the first postback. If the same control is being loaded the
2nd time, then the viewstate is fine.

I understand that I need to re-load the user controls (i.e. LoadControl)
upon a postback to obtain the correct viewstate so as to get to the values
the user entered from the screen. I cannot simply paste the user controls
onto the webform and then set the visibility based on a variable because
there are just too many user controls.

Please could someone help me with this so I can understand it clearly and
move on to other exciting .NET-related things. I really need closure on
this. . .


Regards
John.
 
K

Karl

John,
I'll do my best to help you, but I'm not sure I even see a question in
there. You seem to have an understanding of how it works...that's just how
it is. An alternative would be not to reload the user controls and check
Request.Form which will have the values entered even if you don't reload the
controls.

Anyways, please describe your problem in more detail and I'll do what I
can..

Karl
 
J

John

Hi Karl,

I think I sorted it out - EVENTUALLY!

It seems as thought the main problem I was having was a lack of
understanding regarding the Page life cycle. The reloading I was doing was
placed in the Page_Load event as opposed to the Page_Init event so the
Viewstate was indeed being restored correctly but I was ovewriting it again
with the initial values.

Thanks for the help. Now I can check out the printing and PDF-related stuff.

Incidentally, what is the norm for printing over the internet. Any rules to
conform to?

Regards
John.
 

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

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top