Skip to main content

EntityServerModeDataSource.Selecting Event

Enables you to provide a custom data source.

Namespace: DevExpress.Data.Linq

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public event EventHandler<LinqServerModeDataSourceSelectEventArgs> Selecting

Event Data

The Selecting event's data class is LinqServerModeDataSourceSelectEventArgs. The following properties provide information specific to this event:

Property Description
DefaultSorting Specifies how data source contents are sorted by default, when sort order is not specified by the bound control.
KeyExpression Gets or sets the key expression.
QueryableSource Gets or sets the queryable data source.

Remarks

The Selecting event is raised before data is retrieved from a data source, and allows you to provide a custom data source. The custom data source is specified by the LinqServerModeDataSourceSelectEventArgs.QueryableSource property. In this instance, you should also specify the name of the key property using the LinqServerModeDataSourceSelectEventArgs.KeyExpression property.

Example

The following example illustrates how to use the Selecting event.

protected void EntityServerModeDataSource1_Selecting(object sender, DevExpress.Data.Linq.LinqServerModeDataSourceSelectEventArgs e) {
    var db = new YourDataContext();
    e.KeyExpression = "ID_FIELD_FROM_YOUR_TABLE";
    e.QueryableSource = db.Products;
    //or
    e.QueryableSource = db.Products.Where(p=>p.Price > 10);
    //or other linq query
}
See Also