Custom control collections - IList or ControlCollection

Discussion in 'ASP .Net Building Controls' started by Mark, Apr 27, 2007.

  1. Mark

    Mark Guest

    Dear community,

    I am in the process of designing and writing a custom control that has child
    controls of which I have derived from the Panel WebControl. I am becoming
    confused as to the required implementation of the collection to hold the
    child controls. I have started to implement a Collection class which inherits
    from IList. I have followed roughly the implementation of the frameworks
    ListItemCollection but have now started to become slightly confused about the
    IStateManager implementation. Should I be going down this road or should my
    control collection class just be derived from the ControlCollection class??
    Mark, Apr 27, 2007
    #1
    1. Advertising

  2. Mark

    Mark Guest

    Just to add to my post, I have just been looking at some of the
    System.Web.UI.WebControls implementations for WebControl collections and it
    seems some opt for their collection classes to extend IList and some inherit
    from ControlCollection. I was particularly interested in looking at the
    disassembled MultiView, View and ViewCollection classes as this control seems
    to be close to what my custom control is trying to acheive. Although, when I
    modelled my collection class based on extending ControlCollection I had
    difficulty when trying to cast out my type from a ControlCollection type in
    the Items method.
    What are the rules governing the implementation of custom child control
    collections and managing viewstate? Am I right in thinking that because my
    child controls inherit from existing web controls then I need not to worry
    about viewstate management in the collection? I would be most grateful for
    some advise on this topic.

    "Mark" wrote:

    > Dear community,
    >
    > I am in the process of designing and writing a custom control that has child
    > controls of which I have derived from the Panel WebControl. I am becoming
    > confused as to the required implementation of the collection to hold the
    > child controls. I have started to implement a Collection class which inherits
    > from IList. I have followed roughly the implementation of the frameworks
    > ListItemCollection but have now started to become slightly confused about the
    > IStateManager implementation. Should I be going down this road or should my
    > control collection class just be derived from the ControlCollection class??
    >
    Mark, Apr 27, 2007
    #2
    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. Harry F. Harrison
    Replies:
    0
    Views:
    2,884
    Harry F. Harrison
    Dec 18, 2003
  2. DanielSchaffer

    Inheriting from ControlCollection

    DanielSchaffer, Mar 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    458
    Peter Rilling
    Mar 8, 2005
  3. =?Utf-8?B?R3Vyc2hhcmFu?=

    System.Web.UI.ControlCollection exception

    =?Utf-8?B?R3Vyc2hhcmFu?=, Jul 31, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    714
    =?Utf-8?B?R3Vyc2hhcmFu?=
    Jul 31, 2006
  4. kaoskoder
    Replies:
    0
    Views:
    231
    kaoskoder
    Jan 27, 2004
  5. Gerrit Horeis

    Skinfile overrides ControlCollection of custom control

    Gerrit Horeis, Apr 12, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    126
    Gerrit Horeis
    Apr 12, 2007
Loading...

Share This Page