ObjectDataSourceView.EnablePaging Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets a value indicating whether the data source control supports paging through the set of data that it retrieves.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public bool EnablePaging { get; set; }

Property Value

Type: System.Boolean

true, if the data source control supports paging through the data it retrieves; otherwise, false.

Paging by the ObjectDataSourceView control is handled by setting the EnablePaging, StartRowIndexParameterName, MaximumRowsParameterName, and SelectCountMethod properties of the ObjectDataSourceView and defining a Select method in the business object with the proper parameters. When the EnablePaging property is set to true, the SelectParameters collection includes two additional parameters for the first row requested and the number of rows requested. These two parameters are named as defined by the StartRowIndexParameterName and MaximumRowsParameterName properties. The Select method should return the requested number of rows starting at the specified index. Because the data might not divide evenly by the page size, the last page might contain fewer rows. Thus, the number of rows requested is actually the maximum number of rows that are returned.

The CanRetrieveTotalRowCount property is checked during a call to the ExecuteSelect method to ensure that the data source control supports all capabilities requested by setting the various DataSourceSelectArguments properties.

When paging is enabled on the associated data-bound control, the data-bound control calls the Select method with the start index and number of rows that are required. Additionally, if the SelectCountMethod property is set, the data-bound control calls the method before rendering the pager controls. For example, if a GridView control has paging enabled with a page size of 5, and the SelectCountMethod method returns 20, only 4 pages are displayed in the pager.

The value of the EnablePaging property is stored in view state.

.NET Framework
Available since 2.0
Return to top