private void FillEditorValues(object currentSelectedObject, ASPxComboBox control, WebLookupEditorHelper helper, object currentObject, IModelMember member) { control.Items.Clear(); control.Items.Add(WebPropertyEditor.EmptyValue, null); control.SelectedIndex = 0; if (currentObject != null) { CollectionSourceBase dataSource = helper.CreateCollectionSource(currentObject); if (dataSource != null) { helper.ReloadCollectionSource(dataSource, currentObject); } else { throw new NullReferenceException("currentSelectedObject"); } var list = new ArrayList(); if (dataSource.List != null) { foreach (object t in dataSource.List) { list.Add(t); } } else { if (currentSelectedObject != null) { control.Items.Add( helper.GetEscapedDisplayText(currentSelectedObject, WebPropertyEditor.EmptyValue, member.DisplayFormat), -1); control.SelectedIndex = 1; } return; } if (currentSelectedObject != null && (list.IndexOf(currentSelectedObject) == -1)) { list.Add(currentSelectedObject); } list.Sort(new DisplayValueComparer(helper, WebPropertyEditor.EmptyValue)); foreach (object obj in list) { control.Items.Add( helper.GetEscapedDisplayText(obj, WebPropertyEditor.EmptyValue, member.DisplayFormat), ((XPBaseObject)obj).GetMemberValue(helper.LookupObjectTypeInfo.KeyMember.Name)); // helper.GetObjectKey(obj)); if (currentSelectedObject == obj) { if (obj != null) { control.SelectedIndex = list.IndexOf(obj) + 1; } } } } }
protected override string GetPropertyDisplayValue() { return(_helper.GetEscapedDisplayText(PropertyValue, NullText, DisplayFormat)); }
private void FillEditorValues(object currentSelectedObject, ASPxComboBox control, WebLookupEditorHelper helper, object currentObject, IModelMember member){ control.Items.Clear(); control.Items.Add(WebPropertyEditor.EmptyValue, null); control.SelectedIndex = 0; if (currentObject != null){ CollectionSourceBase dataSource = helper.CreateCollectionSource(currentObject); if (dataSource != null){ helper.ReloadCollectionSource(dataSource, currentObject); } else{ throw new NullReferenceException("currentSelectedObject"); } var list = new ArrayList(); if (dataSource.List != null){ foreach (object t in dataSource.List){ list.Add(t); } } else{ if (currentSelectedObject != null){ control.Items.Add( helper.GetEscapedDisplayText(currentSelectedObject, WebPropertyEditor.EmptyValue, member.DisplayFormat), -1); control.SelectedIndex = 1; } return; } if (currentSelectedObject != null && (list.IndexOf(currentSelectedObject) == -1)){ list.Add(currentSelectedObject); } list.Sort(new DisplayValueComparer(helper, WebPropertyEditor.EmptyValue)); foreach (object obj in list){ control.Items.Add( helper.GetEscapedDisplayText(obj, WebPropertyEditor.EmptyValue, member.DisplayFormat), ((XPBaseObject) obj).GetMemberValue(helper.LookupObjectTypeInfo.KeyMember.Name)); // helper.GetObjectKey(obj)); if (currentSelectedObject == obj){ if (obj != null) control.SelectedIndex = list.IndexOf(obj) + 1; } } } }