Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ViewState Problem in Custom Control

Reply
Thread Tools

ViewState Problem in Custom Control

 
 
Nathan Brady
Guest
Posts: n/a
 
      01-06-2005
I've developed a control that itself generates child controls dynamically,
and everything works great, including capturing events from child controls,
child controls maintaining their own view state, etc.

My one problem is that any values I add to the ViewState dictionary (I'm
currently adding them in my Page_Load handler) do not survive the postback.
They simply disappear. My control derives from WebControl (which is a
requirement), and everything I can find leads me to believe I should be able
to use ViewState without additional code to save/load it.

As a test, I tried to manually mess with overriding SaveViewState and
LoadViewState. For some reason, the object passed to LoadViewState was always
null.

TIA,
Nathan
 
Reply With Quote
 
 
 
 
Mike MacMillan
Guest
Posts: n/a
 
      01-09-2005
Nathan,
if you've overridden the viewstate handling at the control level, and come
up with a null viewstate collection, perhaps the viewstate is turned off at
the page/control level or the .config file level. if that's not the case,
make sure you're calling the base.SaveViewState() method of you're overriden
viewstate handler...

Mike

"Nathan Brady" <Nathan > wrote in message
news:31007FAF-A7A3-41FC-86C7-...
> I've developed a control that itself generates child controls dynamically,
> and everything works great, including capturing events from child

controls,
> child controls maintaining their own view state, etc.
>
> My one problem is that any values I add to the ViewState dictionary (I'm
> currently adding them in my Page_Load handler) do not survive the

postback.
> They simply disappear. My control derives from WebControl (which is a
> requirement), and everything I can find leads me to believe I should be

able
> to use ViewState without additional code to save/load it.
>
> As a test, I tried to manually mess with overriding SaveViewState and
> LoadViewState. For some reason, the object passed to LoadViewState was

always
> null.
>
> TIA,
> Nathan
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom control viewstate problem - please help so i can sleep Walter ASP .Net 0 10-11-2006 10:27 PM
Failed to load viewstate. The control tree into which viewstate... Josema ASP .Net Building Controls 2 05-22-2005 10:38 AM
Failed to load viewstate. The control tree into which viewstate... Josema ASP .Net Web Controls 0 05-09-2005 10:58 AM
ViewState of the Composite Control composed of custom control whoisnidhee ASP .Net Web Controls 2 07-16-2004 08:05 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57