public Control BuildWebControl() { _userControl = _userControlType.ActivateAsUserControl <SelectorTemplateUserControlBase>(this.UiControlID); _userControl.FormControlLabel = this.Label; _userControl.SelectedIndexChangedEventHandler += this.SelectedIndexChangedEventHandler; _userControl.SelectedObjects = new List <object> { this.Selected }; _userControl.Options = this.Options; _userControl.OptionsLabelField = this.OptionsLabelField; _userControl.OptionsKeyField = this.OptionsKeyField; _userControl.BindingType = this.BindingType; _userControl.Required = this.Required; _userControl.ReadOnly = this.ReadOnly; _userControl.ProvideNoSelectionOption = true; return(_userControl); }
public Control BuildWebControl() { _userControl = _userControlType.ActivateAsUserControl <SelectorTemplateUserControlBase>(this.UiControlID); _userControl.FormControlLabel = this.Label; _userControl.Options = this.Options; _userControl.OptionsLabelField = this.OptionsLabelField; _userControl.OptionsKeyField = this.OptionsKeyField; _userControl.BindingType = this.BindingType; _userControl.Required = this.Required; _userControl.MultiSelector = true; _userControl.CompactMode = this.CompactMode; _userControl.SelectedObjects = new List <object>(); if (this.Selected != null) { if (string.IsNullOrEmpty(this.SelectedAsString) == false) { throw new InvalidOperationException("Binding properties 'Selected' and 'SelectedAsString' can not be set at the same time."); } foreach (object obj in this.Selected) { _userControl.SelectedObjects.Add(obj); } } else { if (string.IsNullOrEmpty(this.SelectedAsString) == false) { _userControl.SetSelectedObjectsFromStringList(this.SelectedAsString.Split(',')); } } return(_userControl); }