Table of Contents
RecordCount Property

Gets or sets the total number of records.

Syntax
 public Int32 RecordCount { get; set; }
Remarks

You must use this property to set the total number of records when AllowPaging is set to true because when paging is enabled, the total number of record and the total number of items are usually different. The total number of record is the total number of records in the data source, where as the total number of items are total number of rows in the current page.

The following code demonstrated how to set this property:

//Set the total number of records
Grid1.RecordCount = GetTotalRecordCount();

//Get the data for the current page. The data
//returned is for this page only, thus usually
//have much less number of record than set by
//previous line
Grid1.DataSource = GetDataForCurrentPage(Grid1.CurrentPage);

//Populate the grid
Grid1.DataBind();

See populating the grid for more sample code on using this property.

When AllowPaging is false, this property returns the total number of GridItem in the grid's Items collection. Assigning it a value will be ignored.

Note: RecordCount includes FixedTopItemCount and FixedBottomItemCount.

See Also