Data Source. Deleting Event
Occurs before an object is deleted from the data source.
public: event EventHandler<System::Web::UI::WebControls::EntityDataSourceChangingEventArgs ^> ^ Deleting;
public event EventHandler<System.Web.UI.WebControls.EntityDataSourceChangingEventArgs> Deleting;
member this.Deleting : EventHandler<System.Web.UI.WebControls.EntityDataSourceChangingEventArgs>
Public Custom Event Deleting As EventHandler(Of EntityDataSourceChangingEventArgs)
The Deleting event is raised before the SaveChanges method is called on the ObjectContext to delete an object. The Entity property of the EntityDataSourceChangingEventArgs object is used to access the object to be deleted. The properties of this object may not be fully set. Only the properties required to identify the object must be set.
When you handle the exception in the Deleting event handler, set the ExceptionHandled property to
true. This prevents the exception from being raised again. When you specify a value of
false for the ExceptionHandled property, the EntityDataSource re-raises the exception.