Home All Groups Group Topic Archive Search About

best practive with dropdown list controls in user controls

Author
20 Apr 2006 9:08 PM
dma
Hi all

I have a situation where I have a composite web user control which
centralizes a db lookup.  I am having a problem where it seems viewstate is
being voided and it always loses it's selected index.  I have properly
wrapped the ispostback, so I am sure it is not getting overwritten that way. 
What is most frustrating is that if I move the control out of the web user
control, call it "userlist" and into the web user control that collects
controls into an edit panel, it works like a charm. 

Are there some special properties or atttributes I need to put into my list
style user control for it to persist the selection?

Thanks in advance, this is making me nuts, and making a mess of my project
as I create stand alone versions of the nice web user controls that present
common lookup information.

Thanks!

-DMA

Author
22 Apr 2006 12:11 AM
Peter Johnson
Have you looked at overriding your custom controls Viewstate mechanism.
So that you can store the selected index yourself and control this
yourself?

Issues like this can drive you insane sometimes it is better to take
full control of the situation by writing the code yourself, i've had
some nightmares with custom web controls and this sort of thing.