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 method.
The DataView is returned by the method.
The object is wrapped in a one-element IEnumerable collection and returned by the 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 the method that is specified by the SelectCountMethod property. The 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 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 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 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 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 or DataTable 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 operation.
For more information about parameter merging, object lifetime, and method resolution, see SelectMethod.