A
Adrijan Josic
I have a bunch of user controls that contain TextBoxes,
Repeaters and so on. Some of the user controls even
contain other user controls. The user controls also
usually have some of their properties saved in viewstate.
What I need is: if a user control is not visible it
shouldn't save it's viewstate or the viewstate of the user
controls and server controls it contains and so on
recursively. Im guessing I should override the
SaveViewState method in each of my user controls but I'm
not sure exactly how to do it so that child controls also
lose their viewstate even if they are visible but their
parent is not...
Im sure I could loop through all the parent controls to
see if any of them are not visible to determine is the
control itself visible and the choose to save the view
state, but perhaps there's a better way?
im doing this because most of my user controls are used to
display some result sets when a user clicks somewhere, and
if the user closes them i don't want them to save their
viewstate because I have a lot of them nested and stuff
and eventually when you open them all up once even if you
hide them all they still save a huge viewstate. repeaters
and stuff like that... i can't have 50kb webpages...so I
need to lose their viewstates if they're not visible...
any advice? thanks
Repeaters and so on. Some of the user controls even
contain other user controls. The user controls also
usually have some of their properties saved in viewstate.
What I need is: if a user control is not visible it
shouldn't save it's viewstate or the viewstate of the user
controls and server controls it contains and so on
recursively. Im guessing I should override the
SaveViewState method in each of my user controls but I'm
not sure exactly how to do it so that child controls also
lose their viewstate even if they are visible but their
parent is not...
Im sure I could loop through all the parent controls to
see if any of them are not visible to determine is the
control itself visible and the choose to save the view
state, but perhaps there's a better way?
im doing this because most of my user controls are used to
display some result sets when a user clicks somewhere, and
if the user closes them i don't want them to save their
viewstate because I have a lot of them nested and stuff
and eventually when you open them all up once even if you
hide them all they still save a huge viewstate. repeaters
and stuff like that... i can't have 50kb webpages...so I
need to lose their viewstates if they're not visible...
any advice? thanks