[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Custom control collections - IList or ControlCollection

Mark

4/27/2007 10:08:00 AM

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??

1 Answer

Mark

4/27/2007 1:44:00 PM

0

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??
>