Bold and underline dropdown list menu item asp.net
Here is the code
private void createDDLCategory()
{
ddlCategory.AppendDataBoundItems = true;
ddlCategory.Items.Insert(0, new ListItem("All","A"));
ddlCategory.SelectedIndex = 0;
var ddl1 = dropdownlist.ddlCategoryWithoutGroup();
foreach (var value in ddl1)
{
if (value.P_CATEGORY_ID == null)
{
this.ddlCategory.Items.Add(new ListItem(value.CATEGORY_NAME, value.CATEGORY_ID.ToString()));
this.ddlCategory.Items.FindByValue(value.CATEGORY_ID.ToString()).Selected = false;
this.ddlCategory.Items.FindByValue(value.CATEGORY_ID.ToString()).Attributes.Add("disabled", "true");
this.ddlCategory.Items.FindByValue(value.CATEGORY_ID.ToString()).Attributes.Add("style", "font-weight:bold;");
foreach (var valueChild in ddl1)
{
if (valueChild.P_CATEGORY_ID == value.CATEGORY_ID)
this.ddlCategory.Items.Add(new ListItem(" " + valueChild.CATEGORY_NAME, valueChild.CATEGORY_ID.ToString()));
}
}
}
foreach (ListItem item in ddlCategory.Items)
{
item.Text = HttpUtility.HtmlDecode(item.Text);
}
}
://stackoverflow.com/questions/10120689/bold-and-underline-dropdown-list-menu-item-asp-net
Comments
Post a Comment