/// <summary> /// Loads the defined values. /// </summary> public override void LoadDefinedValues() { EnsureChildControls(); if (DefinedTypeId.HasValue) { var definedTypeCache = DefinedTypeCache.Get(DefinedTypeId.Value); var definedValuesList = definedTypeCache?.DefinedValues.Where(a => a.IsActive || IncludeInactive || SelectedDefinedValuesId.Contains(a.Id)); if (SelectableDefinedValuesId != null && SelectableDefinedValuesId.Any()) { definedValuesList = definedValuesList.Where(a => SelectableDefinedValuesId.Contains(a.Id)); } var filteredList = definedValuesList.OrderBy(v => v.Order).ThenBy(v => v.Value).ToList(); if (filteredList != null && filteredList.Any()) { if (EnhanceForLongLists) { LoadListBox(filteredList); } else { LoadCheckBoxList(filteredList); } } } }
/// <summary> /// Loads the defined values. /// </summary> public override void LoadDefinedValues() { EnsureChildControls(); _ddlDefinedValues.Items.Clear(); if (DefinedTypeId.HasValue) { // add Empty option first _ddlDefinedValues.Items.Add(new ListItem()); var definedTypeCache = DefinedTypeCache.Get(DefinedTypeId.Value); var definedValuesList = definedTypeCache?.DefinedValues.Where(a => a.IsActive || IncludeInactive || a.Id == SelectedDefinedValueId); if (SelectableDefinedValuesId != null && SelectableDefinedValuesId.Any()) { definedValuesList = definedValuesList.Where(a => SelectableDefinedValuesId.Contains(a.Id)); } var filteredList = definedValuesList.OrderBy(v => v.Order).ThenBy(v => v.Value).ToList(); if (filteredList != null && filteredList.Any()) { foreach (var definedValue in filteredList) { _ddlDefinedValues.Items.Add( new ListItem { Text = DisplayDescriptions ? definedValue.Description : definedValue.Value, Value = definedValue.Id.ToString(), Selected = definedValue.Id == SelectedDefinedValueId }); } } } }