แก้ไข

แชร์ผ่าน


ObjectDataSourceView.EnablePaging Property

Definition

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

public:
 property bool EnablePaging { bool get(); void set(bool value); };
public bool EnablePaging { get; set; }
member this.EnablePaging : bool with get, set
Public Property EnablePaging As Boolean

Property Value

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

Remarks

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.

Applies to

See also