System.Web.UI.WebControls.ObjectDataSourceView.SelectMethod Property

Gets or sets the name of the method or function that the System.Web.UI.WebControls.ObjectDataSourceView control invokes to retrieve data.

Syntax

public string SelectMethod { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The specified method can have any method signature but must return one of the types listed in the following table in order for the System.Web.UI.WebControls.ObjectDataSource control to call it successfully

IEnumerable

The IEnumerable is returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

System.Data.DataTable

A System.Data.DataView is created using the System.Data.DataTable and returned by the erload:System.Web.UI.WebControls.ObjectDataSourceView.Select method.

System.Data.DataSet

The first System.Data.DataTable of the System.Data.DataSet is extracted and a System.Data.DataView is created and returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

object

The object is wrapped in a one-element IEnumerable and returned by the ObjectDataSourceView.Select(System.Web.UI.DataSourceSelectArguments) method.

The method that is identified by the ObjectDataSourceView.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 ObjectDataSourceView.SelectMethod method is called. You can handle the ObjectDataSourceView.ObjectCreated event to work with the business object before the method specified by the ObjectDataSourceView.SelectMethod property is called. You can also handle the ObjectDataSourceView.ObjectDisposing event that is raised after the method specified by the ObjectDataSourceView.SelectMethod property is called. (Dispose is called only if the business object implements the IDisposable interface.) If the method is a static (Shared in Visual Basic) method, the business object is never created and you cannot handle these events.

If the business object that the System.Web.UI.WebControls.ObjectDataSource control works with implements more than one method or function with the same name (method overloads), the data source control attempts to invoke the correct one according to a set of conditions, including the parameters in the ObjectDataSourceView.SelectParameters collection. If the parameters in the ObjectDataSourceView.SelectParameters collection do not match those of the signature of the method specified by the ObjectDataSourceView.SelectMethod property, the data source throws an exception.

For more information, see ObjectDataSource.SelectMethod.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0