DropDownList with custom attributes on the items
I've created a custom DropDownList web control that enables the use of custom attributes on its items. This is just a rather simple improvement over the standard .NET web control, but a useful one in my opinion.
For example, this control can be used as follows:
<mad:DropDownList
id="ddlTest"
runat="server">
<asp:ListItem
Value="">An</asp:ListItem>
<asp:ListItem
Value=""
style="color:red;font-weight:bold;text-align:center">invalid</asp:ListItem>
<asp:ListItem
Value="">item</asp:ListItem>
<asp:ListItem
Value="">is in here</asp:ListItem>
</mad:DropDownList>
The result being this:
The source code is
available
of course.
Warning: not all CSS attributes work with
Internet Explorer. This screenshot comes from
Phoenix, but at least the color attribute works with IE.
