private
void
LoadAssigneeList() {
List<AssigneeModel> lstAll = GetAssignees();
ddlCombinedAssignees.Items.Clear();
//Remove all the items, so we don't load more than once
//Add a new category when it changes
int
teamCat = -1;
foreach
(var item
in
lstAll) {
if
(item.TeamID != teamCat) {
teamCat = item.TeamID;
var itmCat =
new
RadComboBoxItem(item.TeamName, item.TeamID.ToString());
itmCat.IsSeparator =
true
;
ddlCombinedAssignees.Items.Add(itmCat);
}
var itm =
new
RadComboBoxItem(item.LastFirst, item.UserID);
ddlCombinedAssignees.Items.Add(itm);
}
}
Here is a method I use. The "GetAssignees" routine is a class or model. It has four properties: LastFirst, UserID, TeamName, TeamID.
I want my categories to be the TeamName, and the items to be the Name (with UserID as the value).
GetAssignees talks to the DB and populates a List<> of the Assignees... I then walk through that to populate the RadComboBox.