Inner Tags and inheirited controls, only want one property

S

Sally

I want to write a custom control that allows inner tags. Something like:

<test:Blob>
<test:ElementBase/>
<test:Element1/>
<test:Element2/>
<test:Element1/>
</test:Blob>

Since Element1 and Element2 are derived from ElementBase, I would
like to only have to have one property in my Blob Class. This does
not seem to be the case. But if I derive a new TableCell class
from TableCell, Table understands my new class without any changes.
How can do I do this for my class?

namespace test
{
public class Blob : WebControl
{
private void AddIt(Element e)
{
// do something here
}

public ElementBase Element {set{AddIt(value);}}
// shouldn't need each of these, but complains without them
public Element1 Element1 {set {AddIt(value);}}
public Element2 Element1 {set {AddIt(value);}}
}

public class ElementBase
{}
public class Element1 : ElementBase
{}
public class Element2 : ElementBase
{}
}
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top