i got a questiong to ask. I got a dropdown list in my app.However the dropdown list is populate with hierarchy format. Please c the picture
As the picture above. How can i bold and underline the parent menu item such as Men , ladies and NA On the other hand , the parent item is not allow to select also.
Here is my coding
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);
}
}
Ur help is appreciate.Thanks
Have you tried this way:
ddlCategory.Items.FindByValue("0").Attributes.Add("style", "font-weight:bolder")
MSDN has mentioned that only few style attributes are applicable for IE.