System.Web.UI.WebControls.SqlDataSource.Inserting Event

Occurs before an insert operation.


public event SqlDataSourceCommandEventHandler Inserting


Handle the SqlDataSource.Inserting event to perform additional initialization operations that are specific to your application, to validate the values of parameters, or to change the parameter values before the System.Web.UI.WebControls.SqlDataSource control performs the insert operation. The connection to the underlying data source is not yet open when the event handler delegate is called. Therefore, you cannot cancel the operation directly by calling the System.Data.Common.DbCommand.Cancel method on the System.Data.Common.DbCommand object that is exposed by the System.Web.UI.WebControls.SqlDataSourceCommandEventArgs property. You can, however, cancel the database operation by setting the System.ComponentModel.CancelEventArgs.Cancel property of the System.Web.UI.WebControls.SqlDataSourceCommandEventArgs object to true.

For more information about handling events, see Consuming Events.


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