Extended ListBox/DropDown - Only Group Name

May 11, 2009 at 6:01 PM

I was needing only a group name without any options under it, i had to change the code to make it works ...

here what i did

 

1) I created a new ListItemGroupingType.GroupOnly enum item

2) in ExtendedListItem.cs, override TOString

I'veAdded the following case

<font size="2">

 

</font>

case ListItemGroupingType.GroupOnly:

{

<font size="2">

 

</font>

return !string.IsNullOrEmpty(this.GroupingText) ? this.GroupingText : "[Group]";

}

 

3) in ExtendedDropDownList.cs and ExtendedListBox.cs, override RenderContents i've added this <font size="2">

 

</font>

else if (item.GroupingType == ListItemGroupingType.GroupOnly)

{

WriteOptionGroup(item, writer);

}

 

Any idea to make it cleaner ?