Need more info on UserControls

L

Lau Lei Cheong

Hello,

I'm writing UserControls as stated earlier. Now I come to the problem
that I need to preserve viewstate in my controls.

If I want to save the informations on the controls, in which event I
have to do so(on main form or on usercontrol)? Or could there be simplier
method such as writing a custom enableviewstate handler?

I've searched in google for tutorials on writing UserControls but much
of them do not cover these topics. Is there any more detailed tutorials
someone can suggest to me, so I need not keep asking questions here that
maybe too fundimential?

Thanks a lot.

Regards,
Lau Lei Cheong
 
T

TJS

I too have searched for materials, books and tutorials on user controls and
found they are limited in availability or limited help.
I handle viewstate in my aspx files as user controls can be shared
 
L

Lau Lei Cheong

The solution in my work now is to override LoadViewState and SaveViewState
methods.

In SaveViewState, I pack everything in the ViewState statebag then call
base.SaveViewState() to pass everything to _viewstate.

In LoadViewState, I pop everything after calling base.LoadViewState() to
restore the settings.

The above runs so far so good.
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top