This documentation is archived and is not being maintained.

EntityDataSource.Selecting Event

Occurs before a query is constructed and executed.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Entity (in System.Web.Entity.dll)

member Selecting : IEvent<EventHandler<EntityDataSourceSelectingEventArgs>,

<asp:EntityDataSource OnSelecting="EventHandler" />

The Selecting event is raised before a query is constructed and executed. Handle the Selecting event to modify the configuration of the EntityDataSource or read or change the arguments from the data-bound control before the query is constructed and executed.

Set the Cancel property of the EntityDataSourceSelectingEventArgs object to true to cancel the query. When the SELECT operation is canceled, no data is returned to the data-bound control.

If AllowPaging is set to true in the data-bound control, the EntityDataSource invokes the Skip and Top query builder methods on ObjectQuery(T) using the values of the StartRowIndex and MaximumRows properties of the DataSourceSelectArguments object.

If AllowSorting is set to true in the data-bound control, the SortExpression of the DataSourceSelectArguments object can be changed when the Selecting event is handled. Any other query operators, such as WHERE or ORDER BY, that are specified in the page markup are applied after the Selecting event is raised.

.NET Framework

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.