private static HtmlBuilder DropDown( this HtmlBuilder hb, Context context, SiteSettings ss, Column column, View view, Dictionary <string, ControlData> optionCollection, string idPrefix = "ViewFilters__", string action = null, bool controlOnly = false) { var selectedValue = view.ColumnFilter(column.ColumnName); if (column.UseSearch == true) { selectedValue?.Deserialize <List <string> >()?.ForEach(value => { if (column.UserColumn) { var userId = value.ToInt(); if (userId > 0 && userId != User.UserTypes.Anonymous.ToInt()) { optionCollection.AddIfNotConainsKey( value, new ControlData(SiteInfo.UserName( context: context, userId: userId))); } } else { HtmlFields.EditChoices( context: context, ss: ss, column: column, value: value) .ForEach(data => optionCollection.AddIfNotConainsKey(data.Key, data.Value)); } }); } return(hb.FieldDropDown( context: context, controlId: idPrefix + column.ColumnName, fieldCss: "field-auto-thin", controlCss: " auto-postback" + (column.UseSearch == true ? " search" : string.Empty), labelText: Displays.Get( context: context, id: column.GridLabelText), labelTitle: ss.LabelTitle(column), controlOnly: controlOnly, action: action, optionCollection: optionCollection, selectedValue: selectedValue, multiple: true, addSelectedValue: false, method: "post", column: column)); }
private static HtmlBuilder DropDown( this HtmlBuilder hb, Context context, SiteSettings ss, Column column, View view, Dictionary <string, ControlData> optionCollection, string idPrefix = "ViewFilters__", string action = null, bool controlOnly = false) { var selectedValue = view.ColumnFilter(column.ColumnName); if (column.UseSearch == true || column.ChoiceHash?.Count == Parameters.General.DropDownSearchPageSize) { selectedValue?.Deserialize <List <string> >()?.ForEach(value => { if (column.Type != Settings.Column.Types.Normal) { var id = value.ToInt(); if (id > 0 && !(column.Type == Settings.Column.Types.User && id == SiteInfo.AnonymousId)) { optionCollection.AddIfNotConainsKey( value, new ControlData(SiteInfo.Name( context: context, id: id, type: column.Type))); } } else { HtmlFields.EditChoices( context: context, ss: ss, column: column, value: value) .ForEach(data => optionCollection.AddIfNotConainsKey(data.Key, data.Value)); } }); } return(hb.FieldDropDown( context: context, controlId: idPrefix + column.ColumnName, fieldCss: "field-auto-thin", controlCss: (ss.UseFilterButton != true ? " auto-postback" : string.Empty) + (column.UseSearch == true ? " search" : string.Empty), labelText: column.GridLabelText, labelTitle: ss.LabelTitle(column), controlOnly: controlOnly, action: action, optionCollection: optionCollection, selectedValue: selectedValue, multiple: true, addSelectedValue: false, method: "post", column: column)); }