.NETGURU
Implementing a control with child controls
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


Roberto Veiga
Hello, people:

I'd like to implement a control called, for instance, "ParentControl",
which in turn has a property called "ChildControls" that represents a
collection (called "ChildControlCollection") of a control called
"ChildControl", so that, when I add ChildControls to the ParentControl's
ChildControls property through the VS.NET dialog box, those ChildControls
appear as nested tags between the ParentControl tags automatically. (Similar
to that which occurs when I add TableRows to the Table's TableRows
property). See bellow:

<control:ParentControl runat="server">
<control:ChildControl runat="server>
</control:ChildControl>
<control:ChildControl runat="server>
</control:ChildControl>
<control:ChildControl runat="server>
</control:ChildControl>
</control:ParentControl>
Some idea? A simple sample will be welcome.

Regards,

Roberto

Reply to this message...
 
    
TIM ELLISON
You need minimum 3 classes:

1) ParentControl
2) ChildControl
3) ChildControlCollection

(3) needs to be a typed collection (i.e., Add, Remove, this[] indexer need
to refer to class ChildControl, inherit System.Collections.CollectionBase)

ChildControlCollection will have an internal constructor that takes a
parameter of type ParentControl. Store that in an instance field.

When the collection methods are implemented, you will redirect your calls to
ParentControl instance's control array.

Look at [I think it's called] UICollectionEditor designer attribute for the
public property in ParentControl that accesses your childcontrol collection.

For ParentControl class look at PersistChildren designer attribute.

Both ParentControl and ChildControl should inherit from
System.Web.UI.WebControls.WebControl.

Regards,

Tim Ellison
Senior Web Applications Developer,
Long and Foster Real Estate
703-359-1884
Click here to reveal e-mail address

-----Original Message-----
From: Roberto Veiga [mailto:Click here to reveal e-mail address]
Sent: Monday, May 07, 2001 9:14 AM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Implementing a control with child controls

Hello, people:

I'd like to implement a control called, for instance, "ParentControl",
which in turn has a property called "ChildControls" that represents a
collection (called "ChildControlCollection") of a control called
"ChildControl", so that, when I add ChildControls to the ParentControl's
ChildControls property through the VS.NET dialog box, those ChildControls
appear as nested tags between the ParentControl tags automatically. (Similar
to that which occurs when I add TableRows to the Table's TableRows
property). See bellow:

<control:ParentControl runat="server">
<control:ChildControl runat="server>
</control:ChildControl>
<control:ChildControl runat="server>
</control:ChildControl>
<control:ChildControl runat="server>
</control:ChildControl>
</control:ParentControl>
Some idea? A simple sample will be welcome.

Regards,

Roberto

| [aspngcontrolscs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Collections.CollectionBase
System.Web.UI.WebControls.WebControl




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification