Inherited DropDownList and asp:listitems

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.
 
G

Gaurav Vaish \(www.EduJini.IN\)

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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top