AD
Administrator
Syncfusion Team
December 6, 2006 08:58 AM UTC
Hi Leema,
This is by design. The Binder.RecordCount property returns the number of records in the root datasource. If you are displaying a grid with nested relations, the only the record count for the root data source is displayed ignoring any expanded nodes. If you want to find the expanded record in a grid, you can handle the RowExpanded and RowCollapsing event of the grid. Here is a code snippet to show this.
public class MyDataBoundGrid : GridDataBoundGrid
{
private int ExpandedRecordCount;
public MyDataBoundGrid()
{
ExpandedRecordCount = 0;
this.RowExpanded +=new GridRowEventHandler(MyDataBoundGrid_RowExpanded);
this.RowCollapsing +=new GridRowEventHandler(MyDataBoundGrid_RowCollapsing);
}
private void MyDataBoundGrid_RowExpanded(object sender, GridRowEventArgs e)
{
GridBoundRecordState state = this.Binder.GetRecordStateAtRowIndex(e.RowIndex);
ExpandedRecordCount += state.ChildCount;
}
private void MyDataBoundGrid_RowCollapsing(object sender, GridRowEventArgs e)
{
GridBoundRecordState state = this.Binder.GetRecordStateAtRowIndex(e.RowIndex);
ExpandedRecordCount -= state.ChildCount;
}
}
You can get the Total visible record using the below line code.
int iVisibleRecord = this.Binder.RecordCount + this.ExpandedRecordCount;
Best Regards,
Haneef