Inherited DropDownList and asp:listitems

  • Thread starter Thread starter Arthur Dent
  • Start date Start date
A

Arthur Dent

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.
 
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.
 
Back
Top