Maintaining viewstate in Collections

Discussion in 'ASP .Net Web Controls' started by Patrick Wilby via .NET 247, Apr 23, 2004.

  1. --------------------------------
    From: Patrick Wilby

    Hi
    I have a custom control inherited from Control that has a coupleof simple string properties and a property which is based onCollectionBase which holds objects of type TabPage(againinherited from Control). The TabPage control has a stringproperty called Caption. Internally the TabPage objects maintainthe state of Caption via viewstate. If I place a TabPage objectonto a web page and change its Caption property (in effectmimicing a textbox) and postback it maintains its state. NoProblem. However, when I place TabPage objects into theCollectionBase collection, and postback I cannot maintain thestate of the Caption property. I have searched every where tofind an answer to this but to no avail. Somehow the collectionproperty needs to persist the state of its items to viewstatei.e. the Caption property of each TabPage object. I've looked atthe IStateManager interface which looks as though this might bethe answer but I am unsure as to where to implement this or how:should it be at the top level i.e. in the Custom contol class orin the Collection class or both? I used the IPostBackDataHandlerinterface in the TabPage class to pick up any changes in statefor that class. Do I need to do the same for this problem? Anyvery simple (its my first custom control)example/strategieswould be most appreciated (VB) preferably.

    Thanks

    Patrick

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>MMaab2ysDEqM/DLf0eynZQ==</Id>
     
    Patrick Wilby via .NET 247, Apr 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dinesh Upare
    Replies:
    0
    Views:
    404
    Dinesh Upare
    Jul 16, 2003
  2. sklett
    Replies:
    4
    Views:
    9,886
    sklett
    Apr 8, 2004
  3. Doug Poland
    Replies:
    9
    Views:
    735
    VisionSet
    Sep 27, 2003
  4. Andrew
    Replies:
    15
    Views:
    562
    Tom Anderson
    Jun 26, 2009
  5. mutex
    Replies:
    0
    Views:
    216
    mutex
    Jul 27, 2003
Loading...

Share This Page