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 property to an object. For example, you can use the 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 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 you set the 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 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 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.
The following example shows how to set the property to the result of a LINQ query.
The following example shows how to set the property to an array of string values is defined in the Web page.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.