Multi-dropdown list

Currently, in asp.net, we can only have one value in the ListItem in DropDownList. However, I hope I can:

<MultiValueDropDownList id="ddl" runat="server" />
ddl.Items.Add(new MultiValueListItem { Text="text", DBValue="db", EngineValue=1 });
var dbValue = ddl.SelectedItem.DBValue;

What I'm going to do is to inherit DropDownList and ListItem. Do you guys have any better solutions?

[Closed]

Finally, I decided to choose a lazy path. Save the values ​​to ListItem.Attributes. And using DropDownList extension methods to help get a set of values. Thank you for your help!

+3
source share

Source: https://habr.com/ru/post/1763551/


All Articles