The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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