Back to Devexpress

BootstrapListBoxField Class

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

latest4.4 KB
Original Source

BootstrapListBoxField Class

Contains settings that define an individual data field providing values to a list editor.

Namespace : DevExpress.Web.Bootstrap

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

NuGet Package : DevExpress.Web.Bootstrap

Declaration

csharp
public class BootstrapListBoxField :
    ListBoxColumn
vb
Public Class BootstrapListBoxField
    Inherits ListBoxColumn

The following members return BootstrapListBoxField objects:

Remarks

A single item of a list editor can display values obtained from several data fields. By default, the displayed values are separated by a semicolon. This functionality is used by list editors such as the BootstrapComboBox and BootstrapListBox.

Fields are stored in a collection of the BootstrapListBoxFieldCollection type, which can be accessed using the list editor’s Fields property. An individual field can be accessed within the collection using indexer notation. A field can be mapped to a data source’s column using the ListBoxColumn.FieldName property.

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>
csharp
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);
}

Note

The Custom Filtering online demo shows the result of the code executed above.

Inheritance

Object StateManager CollectionItem WebColumnBase ListBoxColumn BootstrapListBoxField

See Also

BootstrapListBoxField Members

DevExpress.Web.Bootstrap Namespace