Provides data for the SqlDataSource.Updating, SqlDataSource.Deleting and SqlDataSource.Inserting events of the System.Web.UI.WebControls.SqlDataSource control.
See Also: SqlDataSourceCommandEventArgs Members
By adding an event handler delegate to handle the SqlDataSource.Updating, SqlDataSource.Inserting, or SqlDataSource.Deleting events, you can perform any additional preprocessing required or cancel the database command entirely.
Because the System.Web.UI.WebControls.SqlDataSourceCommandEventArgs class is derived from the System.ComponentModel.CancelEventArgs class, you can cancel a pending System.Web.UI.WebControls.SqlDataSource database command 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 command properties prior to running the command by accessing the System.Data.Common.DbCommand object exposed by the SqlDataSourceCommandEventArgs.Command property.
The System.Web.UI.WebControls.SqlDataSourceCommandEventArgs class is used in the SqlDataSourceView.OnUpdating(SqlDataSourceCommandEventArgs), SqlDataSourceView.OnInserting(SqlDataSourceCommandEventArgs), and SqlDataSourceView.OnDeleting(SqlDataSourceCommandEventArgs) methods to provide access to a System.Web.UI.WebControls.SqlDataSource database command 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 and event handler classes, to better guide you to the various events that correspond to the lifecycle of a data operation using the System.Web.UI.WebControls.SqlDataSource control.
SqlDataSource.Selecting occurs before the data is retrieved. |
System.Web.UI.WebControls.SqlDataSourceSelectingEventHandler | |
SqlDataSource.Inserting, SqlDataSource.Updating, SqlDataSource.Deleting occur before an insert, update, or delete operation is performed. | ||
SqlDataSource.Selected, SqlDataSource.Inserted, SqlDataSource.Updated, SqlDataSource.Deleted occur after the data retrieval, insert, update, or delete operations completes. |