Reputation: 2184
I am trying to create a custom control that inherits from DropDownList.
What I need is to add a new property to a ListItem(within Item collection).
<cc1:MyDropDownList ID="MyDropDownList1" runat="server">
<asp:ListItem myProperty="true" text="sometext" ... />
</cc1: MyDropDownList>
How can I do that?
Upvotes: 2
Views: 2767
Reputation:
Even if you inherit from the DropDownList you cannot add this property because you have to add it to the ListItem control.
But the problem is that ListItem class is sealed so you cannot inherit from it.
Upvotes: 3