Edit

Share via


LinqDataSource.ContextCreated Event

Definition

Occurs after an instance of the context type object is created.

public:
 event EventHandler<System::Web::UI::WebControls::LinqDataSourceStatusEventArgs ^> ^ ContextCreated;
public event EventHandler<System.Web.UI.WebControls.LinqDataSourceStatusEventArgs> ContextCreated;
member this.ContextCreated : EventHandler<System.Web.UI.WebControls.LinqDataSourceStatusEventArgs> 
Public Custom Event ContextCreated As EventHandler(Of LinqDataSourceStatusEventArgs) 

Event Type

Remarks

Handle the ContextCreated event to examine the context type object or examine exceptions that are raised while the object is being created. You retrieve the context type object from the Result property of the LinqDataSourceStatusEventArgs object that is associated with this event. You retrieve the exception that was raised during the data operation from the Exception property.

The context type object is created during select, update, insert, and delete operations and is reused throughout the request.

There is one time when the event is not raised. This is when you programmatically set the Result property to an object during the Selecting event. An additional condition is that either the original values do not have to be stored in view state, or the object in the Result property implements the ITable interface.

Applies to