We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

VerticalScrol l Problem

protected override void OnMouseWheel(MouseEventArgs e)
{
if ((e.Delta > 0 ) && (this.Binder.CurrentPosition >0) )
{
this.Binder.CurrentPosition = this.Binder.CurrentPosition - 1;
this.ScrollCellInView(this.Binder.CurrentPosition, 0);
}
if ((e.Delta < 0 ) && (this.Binder.CurrentPosition < this.Binder.RecordCount-1) )
{
this.Binder.CurrentPosition = this.Binder.CurrentPosition + 1;
this.ScrollCellInView(this.Binder.CurrentPosition+1, 0);
}


}


This code doesnt works for heirarchical griddataboundgrid.

this.Binder.RecordCount-1 returns only parent table record count.


1 Reply

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

Loader.
Live Chat Icon For mobile
Up arrow icon