FilterBuilderFieldLookupBuilder.DataSource(IEnumerable, String[]) Method

Binds a lookup field to a collection: Array, List, or IEnumerable.

Namespace: DevExtreme.AspNet.Mvc.Builders

Assembly: DevExtreme.AspNet.Core.dll

Declaration

public FilterBuilderFieldLookupBuilder DataSource(
    IEnumerable data,
    params string[] key
)

Parameters

Name Type Description
data IEnumerable

A collection that supplies data for the control.

key String[]

An array that contains one or more key field names.

Returns

Type Description
FilterBuilderFieldLookupBuilder

A reference to this instance after the method is called.

Remarks

This method is a shorthand version of the DataSourceFactory.Array() method. The following examples are equivalent:

@(Html.DevExtreme().FilterBuilder()
    .Fields(fields => {
        fields.Add().Lookup(lookup => lookup
            .DataSource(Model.MyCollection, "ID")
        );
    })
)
@(Html.DevExtreme().FilterBuilder()
    .Fields(fields => {
        fields.Add().Lookup(lookup => lookup
            .DataSource(ds => ds.Array()
                .Data(Model.MyCollection)
                .Key("ID")
            )
        );
    })
)

Refer to CLR Objects for more information.

See Also