Building Nested Controls

G

Gaurav Vaish

Hi,

I want to have a control that can have children like:

<prefix:parent ... runat="server">
<Children>
<prefix:Child .... runat="server"/>
</Children>
</prefix:parent>


When I try to launch the page, it gives me error that:

"Children" does not have a property named "prefix:Child". Where am I
missing?

I also tried by having a custom-"ControlBuilder", but then it seemed I
required a CCB for both Children as well as Child requiring both of them to
be Control's. There's something that I'm missing... unable to track what.



---------------------------------
I have create the classes as follows:

[ParseChildren(false)]
Parent : WebControl, IStateManager
{
....
Children Children { get { return this.children; } }
}

Children : IEnumerable, IStateManager
{
...
Child this[int] { get; set; }

Add(Entry e) { ... }
Remove(Entry e) { ... }
Clear() { ... }

IEnumerator GetEnumerator() { ... }
// IStateManager members ....
}

Child : WebControl
{
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top