Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add separators in DropDownList

Tags:

c#

asp.net

i have a scenario where i have to add separators in DropDownList in asp.net. Please, suggest.

like image 255
Shivi Avatar asked Feb 01 '11 09:02

Shivi


2 Answers

you can use disabled items as separators

example:

ListItem separator = new ListItem("---element---", "");
separator.Attributes.Add("disabled", "true");
ddltest.Items.Add(separator);
like image 197
None Avatar answered Sep 19 '22 14:09

None


Just add like this:

<asp:ListItem disabled>-------------</asp:ListItem>
like image 20
Yiping Avatar answered Sep 21 '22 14:09

Yiping