DaveGoosem
6/16/2013 - 11:55 PM

Populate Drop Down List with Sitecore data template items

Populate Drop Down List with Sitecore data template items

//IncidentCategoryList is the list control
//In this example we are only showing child items of the datasourced item which are using a specific Sitecore template named 'IncidentCategory'

foreach (
    var categoryDropDownItem in
        DataSourceItem(IncidentCategoryItemId).Children.Where(z => z.TemplateName == "IncidentCategory"))
{
    IncidentCategoryList.Add(categoryDropDownItem.DisplayName);
}