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

After Deleting Record from grid scroll is not working

Scrolling option is not working after deleting record from a grid. Out of Range Exception Coming..any idea. I am sending code here 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); } } Regards shashi

3 Replies

AD Administrator Syncfusion Team June 2, 2006 11:00 AM UTC

Hi Shashi, You need to change the currentcell position and binder.currentPosition before delete the record from the grid. Here is a code snippet this.gridDataBoundGrid1.Binder.EndEdit(); this.gridDataBoundGrid1.Binder.SuspendBinding() ; int RowIndex = this.gridDataBoundGrid1.CurrentCell.RowIndex; int ColIndex = this.gridDataBoundGrid1.CurrentCell.ColIndex; int Position = this.gridDataBoundGrid1.Binder.CurrentPosition; ArrayList list = this.gridDataBoundGrid1.DataSource as ArrayList; if(list != null ) { this.gridDataBoundGrid1.CurrentCell.MoveTo(0,0); this.gridDataBoundGrid1.Binder.CurrentPosition = 0; list.RemoveAt(list.Count -1 ); } this.gridDataBoundGrid1.Binder.ResumeBinding(); this.gridDataBoundGrid1.Binder.EndEdit(); this.gridDataBoundGrid1.Refresh(); this.gridDataBoundGrid1.Focus(); this.gridDataBoundGrid1.CurrentCell.MoveTo(RowIndex , ColIndex); this.gridDataBoundGrid1.Binder.CurrentPosition = Position; Here is a sample. http://www.syncfusion.com/Support/user/uploads/arraylistsource_3f0b7e16.zip Could you please run this at your end and let me know how it goes? Thanks for choosing Syncfusion Products. Regards, Haneef


LE Leema December 1, 2006 05:53 AM UTC

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.Binder.RecordCount returns only root tables recordcount so scroll comes upto that row count but there are around 150 rows.

Is there any solution...

Thanks in Advance...


AD Administrator Syncfusion Team December 6, 2006 10:10 AM UTC

Hi Leema,

Please refer to the below forum thread for more details.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=52923

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon