Back to Devexpress

BootstrapComboBox.Fields Property

aspnetbootstrap-devexpress-dot-web-dot-bootstrap-dot-bootstrapcombobox.md

latest3.5 KB
Original Source

BootstrapComboBox.Fields Property

Provides access to a ComboBox’s field collection.

Namespace : DevExpress.Web.Bootstrap

Assembly : DevExpress.Web.Bootstrap.v25.2.dll

NuGet Package : DevExpress.Web.Bootstrap

Declaration

csharp
[PersistenceMode(PersistenceMode.InnerProperty)]
[Themeable(false)]
public BootstrapListBoxFieldCollection Fields { get; }
vb
<PersistenceMode(PersistenceMode.InnerProperty)>
<Themeable(False)>
Public ReadOnly Property Fields As BootstrapListBoxFieldCollection

Property Value

TypeDescription
BootstrapListBoxFieldCollection

A BootstrapListBoxFieldCollection object which represents a collection of all the fields within a ComboBox.

|

Remarks

This property stores all the fields present in the ComboBox control. It allows you to add and delete fields using the appropriate methods.

Individual fields can be accessed using indexed notation or the bound field name as parameters. If the bound field name is used as an indexer and there are several fields with the same name, the first field found in the collection will be returned.

This property is a wrapper of the BootstrapComboBoxProperties.Fields property. Please refer to its description for more information.

aspx
<dx:BootstrapComboBox ID="ComboBoxCustomFiltering" runat="server" OnCustomFiltering="ComboBoxCustomFiltering_CustomFiltering"
    DataSourceID="CustomersDataSource" ValueField="CustomerID" ValueType="System.String" EnableCallbackMode="true">
    <Fields>
        <dx:BootstrapListBoxField FieldName="CompanyName" />
        <dx:BootstrapListBoxField FieldName="Country" />
    </Fields>
</dx:BootstrapComboBox>
<ef:EntityDataSource runat="server" ID="CustomersDataSource" ContextTypeName="DevExpress.Web.Demos.NorthwindContextSL" EntitySetName="Customers">
</ef:EntityDataSource>
cs
protected void ComboBoxCustomFiltering_CustomFiltering(object sender, ListEditCustomFilteringEventArgs e) {
    string[] words = e.Filter.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    string[] dataFields = new string[] { "CompanyName", "Country" };
    e.FilterExpression = DevExpress.Data.Filtering.GroupOperator.And(words.Select(w =>
        DevExpress.Data.Filtering.GroupOperator.Or(
            dataFields.Select(f =>
                new DevExpress.Data.Filtering.FunctionOperator(DevExpress.Data.Filtering.FunctionOperatorType.Contains, new DevExpress.Data.Filtering.OperandProperty(f), w)
            )
        )
    )).ToString();
    e.CustomHighlighting = dataFields.ToDictionary(f => f, f => words);
}

See Also

Combo Box

BootstrapComboBox Class

BootstrapComboBox Members

DevExpress.Web.Bootstrap Namespace