Assembly: System.Web (in system.web.dll)
The specified method might have any method signature, but it must return or be derived from one of the types listed in the following table for the ObjectDataSource control to call it successfully.
The IEnumerable is returned by the Select method.
A DataView is created using the DataTable and returned by the Select method.
The DataView is returned by the Select method.
The first DataTable of the DataSet is extracted and a DataView is created and returned by the Select method.
The object is wrapped in a one-element IEnumerable collection and returned by the Select method.
The method that is identified by the SelectMethod property can be an instance method or a static (Shared in Visual Basic) method. If it is an instance method, the business object is created and destroyed each time the method that is specified by the SelectMethod property is called, except that the same instance is used to call the method that is specified by the SelectMethod property and method that is specified by the SelectCountMethod property. The Select method returns an IEnumerable interface; however, to enable caching and filtering scenarios, the return value must be a DataSet object. While the DataSet class does not implement the IEnumerable interface, the ObjectDataSource control automatically extracts the default DataView control, which implements the IEnumerable.
Before the Select operation is performed, the OnSelecting method is called to raise the Selecting event. You can handle the Selecting event to examine the values of the parameters and to perform any preprocessing before a Select operation. To perform a data retrieval operation, the ObjectDataSourceView object uses reflection to create an instance of the object that is identified by the TypeName property. It then calls the method that is identified by the SelectMethod property, using any associated SelectParameters properties. After the Select operation completes, the OnSelected method is called to raise the Selected event. You can handle the Selected event to examine any return values, output parameters, and exceptions, and to perform any post-processing.
If the SelectMethod property returns a DataSet, DataTable, or DataView object and caching is enabled, the ObjectDataSource retrieves data from and saves data to the cache during the Select operation. The cache is created, discarded, or refreshed based on the caching behavior that is specified by the combination of the CacheDuration and CacheExpirationPolicy properties.
If the SelectMethod property returns a DataSet, DataTable, or DataView object and a FilterExpression property has been specified, it is evaluated with any supplied FilterParameters properties and the resulting filter is applied to the list of data during the Select operation.
The Select method delegates to the Select method of the ObjectDataSourceView that is associated with the ObjectDataSource control.
For more information on parameter merging, object lifetime, and method resolution, see SelectMethod.
When the ObjectDataSource control is associated with a data-bound control, such as the GridView control, it is not necessary to call the Select method from page code. The Select method is invoked directly by the data-bound control instead.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.