Inner Tags and inheirited controls, only want one property

Discussion in 'ASP .Net Web Controls' started by Sally, Apr 13, 2004.

  1. Sally

    Sally Guest

    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
    {}
    }
     
    Sally, Apr 13, 2004
    #1
    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. Greg Smith
    Replies:
    35
    Views:
    3,216
    Alex Kay
    Oct 24, 2004
  2. jlopes
    Replies:
    5
    Views:
    460
    le ténébreux
    Nov 19, 2004
  3. jlopes
    Replies:
    7
    Views:
    438
    jlopes
    Nov 19, 2004
  4. Alexander Higgins
    Replies:
    3
    Views:
    1,102
    Teemu Keiski
    Jul 30, 2007
  5. Alexander Higgins
    Replies:
    0
    Views:
    465
    Alexander Higgins
    Jul 21, 2007
Loading...

Share This Page