Inherited DropDownList and asp:listitems

Discussion in 'ASP .Net' started by Arthur Dent, Aug 15, 2006.

  1. Arthur Dent

    Arthur Dent Guest

    Hi all,

    I have a control which i wrote which inherits the asp:dropdownlist control.
    Works great, all happy.
    If when using it i try to declaratively add some items, it complains that
    they are unknown types. eg...

    <mytag:mydropdownlist id="lstInherited" runat="server"
    appenddatabounditems="true" >
    <asp:listitem id="" value="select an item" >
    </mytag:mydropdownlist>

    It complains that asp:listitem is an unknown element. How can i direct the
    runtime that my dropdownlist
    control can contain asp:listitems like its base class? I assume some sort of
    attribute on the class, but i am
    looking for any direction as to what attribute.
    Thanks in advance,
    - Arthur Dent.
     
    Arthur Dent, Aug 15, 2006
    #1
    1. Advertising

  2. Look into the following attribtue:
    ParseChildrenAttribute (System.Web.UI)
    PersistChildrenAttribute (System.Web.UI)

    The child controls, by default, are not accepted.
    You may also need to override AddedParsedSubObject method for type-safety of
    the controls added.

    --
    Happy Hacking,
    Gaurav Vaish | http://www.mastergaurav.org
    http://www.edujini.in | http://webservices.edujini.in
    -------------------


    "Arthur Dent" <> wrote in message
    news:%...
    > Hi all,
    >
    > I have a control which i wrote which inherits the asp:dropdownlist
    > control. Works great, all happy.
    > If when using it i try to declaratively add some items, it complains that
    > they are unknown types. eg...
    >
    > <mytag:mydropdownlist id="lstInherited" runat="server"
    > appenddatabounditems="true" >
    > <asp:listitem id="" value="select an item" >
    > </mytag:mydropdownlist>
    >
    > It complains that asp:listitem is an unknown element. How can i direct the
    > runtime that my dropdownlist
    > control can contain asp:listitems like its base class? I assume some sort
    > of attribute on the class, but i am
    > looking for any direction as to what attribute.
    > Thanks in advance,
    > - Arthur Dent.
    >
     
    Gaurav Vaish \(www.EduJini.IN\), Aug 16, 2006
    #2
    1. Advertising

  3. Arthur Dent

    Arthur Dent Guest

    Thanks for the tips....
    I will check out those attribs/methods.
    Cheers!


    "Gaurav Vaish (www.EduJini.IN)" <> wrote
    in message news:...
    > Look into the following attribtue:
    > ParseChildrenAttribute (System.Web.UI)
    > PersistChildrenAttribute (System.Web.UI)
    >
    > The child controls, by default, are not accepted.
    > You may also need to override AddedParsedSubObject method for type-safety
    > of the controls added.
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish | http://www.mastergaurav.org
    > http://www.edujini.in | http://webservices.edujini.in
    > -------------------
    >
    >
    > "Arthur Dent" <> wrote in message
    > news:%...
    >> Hi all,
    >>
    >> I have a control which i wrote which inherits the asp:dropdownlist
    >> control. Works great, all happy.
    >> If when using it i try to declaratively add some items, it complains that
    >> they are unknown types. eg...
    >>
    >> <mytag:mydropdownlist id="lstInherited" runat="server"
    >> appenddatabounditems="true" >
    >> <asp:listitem id="" value="select an item" >
    >> </mytag:mydropdownlist>
    >>
    >> It complains that asp:listitem is an unknown element. How can i direct
    >> the runtime that my dropdownlist
    >> control can contain asp:listitems like its base class? I assume some sort
    >> of attribute on the class, but i am
    >> looking for any direction as to what attribute.
    >> Thanks in advance,
    >> - Arthur Dent.
    >>

    >
    >
     
    Arthur Dent, Aug 16, 2006
    #3
    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. Doug
    Replies:
    7
    Views:
    5,481
    Scott G.
    Aug 2, 2004
  2. Jeff
    Replies:
    1
    Views:
    6,531
    Bruce Barker
    Mar 18, 2005
  3. HoustonFreeways

    Dropdownlist: handling very wide listitems

    HoustonFreeways, Aug 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,229
    HoustonFreeways
    Aug 3, 2005
  4. Vincent
    Replies:
    3
    Views:
    940
    Vincent
    Mar 7, 2008
  5. Arthur Dent

    Inherited DropDownList and asp:listitems

    Arthur Dent, Aug 15, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    150
    Arthur Dent
    Aug 16, 2006
Loading...

Share This Page