This documentation is archived and is not being maintained.

LinqDataSourceStatusEventArgs::Exception Property

Gets the exception that was thrown during the data operation.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public:
property Exception^ Exception {
	Exception^ get ();
}

Property Value

Type: System::Exception
An Exception object that represents the exception, if an error occurred; otherwise, nullptr.

If an exception is raised during the data operation, the exception is stored in the Exception property. You can create event handlers for the ContextCreated, Deleted, Inserted, Selected, and Updated events and retrieve the exception, if any, through the Exception property.

The following example shows an event handler for the Inserted event. In the event handler, if the Exception property is nullptr, the product ID is retrieved from the object in the Result property. The product ID is a primary key for the table and is set by the database, so the value is not known until the insert operation has finished. The exception message is logged if the Exception property is not equal to nullptr. The ExceptionHandled property is then set to true.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: