System.Web.UI.WebControls.ObjectDataSourceEventArgs Class

Provides data for the ObjectDataSource.ObjectCreating and ObjectDataSource.ObjectCreated events of the System.Web.UI.WebControls.ObjectDataSource control.

See Also: ObjectDataSourceEventArgs Members

Syntax

public class ObjectDataSourceEventArgs : EventArgs

Remarks

The System.Web.UI.WebControls.ObjectDataSourceEventArgs class is used in the ObjectDataSourceView.OnObjectCreating(ObjectDataSourceEventArgs) and ObjectDataSourceView.OnObjectCreated(ObjectDataSourceEventArgs) methods to provide access to the business object instance before any data operations that are using the System.Web.UI.WebControls.ObjectDataSource control and business object are performed. The business object is set and accessed using the ObjectDataSourceEventArgs.ObjectInstance property. By adding an event handler delegate to handle the ObjectDataSourceView.ObjectCreating event, you can create an instance of the business object in custom code instead of the System.Web.UI.WebControls.ObjectDataSource performing the instantiation. This is useful when you want a non-default instance of your business object or to call a non-default constructor to create the instance; the System.Web.UI.WebControls.ObjectDataSource always calls the default constructor to create an instance of the business object it works with. You can also add an event handler delegate to handle the ObjectDataSource.ObjectCreated event, which enables you to access any publicly exposed members of the business object to perform any additional initialization or work.

The ObjectDataSourceView.OnObjectCreating(ObjectDataSourceEventArgs) and ObjectDataSourceView.OnObjectCreated(ObjectDataSourceEventArgs) methods are not called by the System.Web.UI.WebControls.ObjectDataSource control, if the business object method that performs the data operations is static.

The System.Web.UI.WebControls.ObjectDataSource control exposes many events that you can handle to work with the underlying business object at various times in its lifecycle. The following table lists the events and the associated EventArgs classes and event handler delegates.

ObjectDataSource.ObjectCreating.

Occurs immediately before the instance of the business object is created.

System.Web.UI.WebControls.ObjectDataSourceEventArgs

System.Web.UI.WebControls.ObjectDataSourceObjectEventHandler

ObjectDataSource.ObjectCreated.

Occurs immediately after the instance of the business object is created.

System.Web.UI.WebControls.ObjectDataSourceEventArgs

System.Web.UI.WebControls.ObjectDataSourceObjectEventHandler

ObjectDataSource.Selecting.

Occurs before the data is retrieved.

System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs

System.Web.UI.WebControls.ObjectDataSourceSelectingEventHandler

ObjectDataSource.Inserting, ObjectDataSource.Updating, and ObjectDataSource.Deleting.

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

System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs

System.Web.UI.WebControls.ObjectDataSourceMethodEventHandler

ObjectDataSource.Selected.

Occurs after the data is retrieved.

System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs

System.Web.UI.WebControls.ObjectDataSourceStatusEventHandler

ObjectDataSource.Inserted, ObjectDataSource.Updated, ObjectDataSource.Deleted.

Occur after the insert, update, or delete operation is completed.

System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs

System.Web.UI.WebControls.ObjectDataSourceStatusEventHandler

ObjectDataSource.ObjectDisposing.

Occurs before a business object is destroyed.

System.Web.UI.WebControls.ObjectDataSourceDisposingEventArgs

System.Web.UI.WebControls.ObjectDataSourceDisposingEventHandler

Requirements

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