LinqDataSourceSelectEventArgs::Result Property
Gets or sets the data object that is used in the data query.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
By default, the LinqDataSource control applies its query expressions to the object defined in the TableName property. In a handler for the Selecting event, you can manually change which object is queried by setting the Result property to an object. For example, you can use the Result property to query an in-memory collection in the Web page, or to get the results from a LINQ query expression. You can set the Result property to any object. If the object does not implement the IEnumerable<T> interface, the LinqDataSource control wraps the object in an object that does implement the IEnumerable<T> interface.
When the Result property is set to any value other than nullptr, the LinqDataSource control does not query the object defined in the TableName property. Instead, it queries the object in the Result property.
Note |
|---|
When you set the Result property to an object, do not use nullptr to represent an object that does not contain any data. The LinqDataSource control interprets nullptr to mean that the Result property is not set, and it will create and query the object in the TableName property. To represent an object that does not contain data, set the Result property to an IList or IList<T> object that does not contain any elements. |
The ContextCreating, ContextCreated, and ContextDisposing events are not raised when you programmatically set the Result property to an object, and when two additional conditions apply. The conditions are 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.
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.
Note