System.Web.UI.DataSourceSelectArguments Class

Provides a mechanism that data-bound controls use to request data-related operations from data source controls when data is retrieved. This class cannot be inherited.

See Also: DataSourceSelectArguments Members

Syntax

public sealed class DataSourceSelectArguments

Remarks

Data-bound controls use the System.Web.UI.DataSourceSelectArguments class to request that a data source control performs additional data-related operations on a result set, such as sorting the data or returning a specific subset of data. These data-related operations are enumerated by the System.Web.UI.DataSourceCapabilities enumeration. The following table indicates how the System.Web.UI.DataSourceSelectArguments class supports these data-related operations.

DataSourceCapabilities.Sort

DataSourceSelectArguments.SortExpression

DataSourceCapabilities.Page

DataSourceSelectArguments.StartRowIndex, DataSourceSelectArguments.MaximumRows

DataSourceCapabilities.RetrieveTotalRowCount

DataSourceSelectArguments.RetrieveTotalRowCount, DataSourceSelectArguments.TotalRowCount

Data-bound controls explicitly call the System.Web.UI.WebControls.DataBoundControl.PerformSelect method to bind data, which calls the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method of the data source control they are associated with. In this way, the data-bound control retrieves data from the data source control on demand. Because the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method accepts a System.Web.UI.DataSourceSelectArguments parameter, the data-bound control is responsible for creating and managing a System.Web.UI.DataSourceSelectArguments object and passing it to the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method when it retrieves data from the data source control.

In some cases, data-bound controls might not need any additional data-related capabilities. In this case, data-bound controls pass an DataSourceSelectArguments.Empty arguments object to the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

For sorted result sets, data-bound controls check a data source view's DataSourceView.CanSort property at run time, and add a DataSourceCapabilities.Sort capability using the DataSourceSelectArguments.AddSupportedCapabilities(DataSourceCapabilities) method. As a separate operation, the data-bound control can request a sorted result set from a data source control by setting the DataSourceSelectArguments.SortExpression property on the System.Web.UI.DataSourceSelectArguments object passed to the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

For paging scenarios, data-bound controls check a data source view's DataSourceView.CanPage property at run time, and add a DataSourceCapabilities.Page capability using the DataSourceSelectArguments.AddSupportedCapabilities(DataSourceCapabilities) method. As a separate operation, the data-bound control can request a subset of data from a data source control for paging by setting the DataSourceSelectArguments.StartRowIndex and DataSourceSelectArguments.MaximumRows properties on the System.Web.UI.DataSourceSelectArguments object passed to the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method.

To retrieve a total row count for paging scenarios, data-bound controls check a data source view's DataSourceView.CanRetrieveTotalRowCount property at run time, and add a DataSourceCapabilities.RetrieveTotalRowCount capability using the DataSourceSelectArguments.AddSupportedCapabilities(DataSourceCapabilities) method. As a separate operation, the data-bound control can request a total row count from a data source control for paging by setting the DataSourceSelectArguments.RetrieveTotalRowCount property on the System.Web.UI.DataSourceSelectArguments object passed to the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method. When the DataSourceView.Select(DataSourceSelectArguments, DataSourceViewSelectCallback) method returns, the total row count is contained by the DataSourceSelectArguments.TotalRowCount property.

Note:

If any of the System.Web.UI.DataSourceSelectArguments properties are set, but the currently bound data source control does not support the requested capability, an InvalidOperationException exception is thrown when the DataSourceSelectArguments.RaiseUnsupportedCapabilitiesError(DataSourceView) method is called.

Requirements

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