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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

VerticalScrol l Problem

Thread ID:

Created:

Updated:

Platform:

Replies:

52923 Dec 6,2006 04:53 AM UTC Dec 6,2006 08:58 AM UTC Windows Forms 1
loading
Tags: GridControl
leemarose
Asked On December 6, 2006 04:53 AM UTC

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.


Administrator [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;