System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs Class

Provides data for the SqlDataSource.Selecting event of the System.Web.UI.WebControls.SqlDataSource control.

See Also: SqlDataSourceSelectingEventArgs Members

Syntax

public class SqlDataSourceSelectingEventArgs : SqlDataSourceCommandEventArgs

Remarks

By adding an event handler delegate to handle the SqlDataSource.Selecting event, you can perform any additional preprocessing required or cancel the database query entirely. Because the System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs class is derived from the System.Web.UI.WebControls.SqlDataSourceCommandEventArgs class, you can cancel a pending System.Web.UI.WebControls.SqlDataSource database query by setting the System.ComponentModel.CancelEventArgs.Cancel property to true. You can examine and manipulate the System.Data.Common.DbCommand.CommandText, System.Data.Common.DbCommand.Parameters collection, and other database query properties prior to running the query by accessing the System.Data.Common.DbCommand object exposed by the SqlDataSourceCommandEventArgs.Command property. You can also examine the System.Web.UI.DataSourceSelectArguments object that is passed to the SqlDataSource.Select(System.Web.UI.DataSourceSelectArguments) method by accessing the SqlDataSourceSelectingEventArgs.Arguments property.

The System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs class is used in the SqlDataSourceView.OnSelecting(SqlDataSourceSelectingEventArgs) method to provide access to a System.Web.UI.WebControls.SqlDataSource database query before it is run.

The System.Web.UI.WebControls.SqlDataSource control exposes many events that you can handle to work with the underlying data objects during the course of a data operation. The following table lists the events and associated EventArgs classes and event handler delegates.

SqlDataSource.Selecting.

Occurs before the data is retrieved.

System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs

System.Web.UI.WebControls.SqlDataSourceSelectingEventHandler

SqlDataSource.Inserting, SqlDataSource.Updating, and SqlDataSource.Deleting.

Occur before an insert, update, or delete operation is performed.

System.Web.UI.WebControls.SqlDataSourceCommandEventArgs

System.Web.UI.WebControls.SqlDataSourceCommandEventHandler

SqlDataSource.Selected, SqlDataSource.Inserted, SqlDataSource.Updated, and SqlDataSource.Deleted.

Occur after the data retrieval, insert, update, or delete operation completes.

System.Web.UI.WebControls.SqlDataSourceStatusEventArgs

System.Web.UI.WebControls.SqlDataSourceStatusEventHandler

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0