Completed
Last Updated: 01 Dec 2015 09:35 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 30 Oct 2015 09:45
Category: GridView
Type: Bug Report
1
FIX. RadGridView - ArgumentOutOfRangeException when deleting a row in sorted grid
To reproduce: use DataAccess to connect to Northwind.Customer table:

public Form1()
{
    InitializeComponent();
    EntitiesModel1 context = new EntitiesModel1();
    var query = (from c in context.Customers where c.CustomerID.Contains("f") select c).ToList();
    this.radGridView1.DataSource =  query;
    
    SortDescriptor descriptor = new SortDescriptor();
    descriptor.PropertyName = "CustomerID";
    descriptor.Direction = ListSortDirection.Ascending;
    this.radGridView1.MasterTemplate.SortDescriptors.Add(descriptor);
    this.radGridView1.CurrentRow = this.radGridView1.Rows.Last();
}

Run the project and press the Delete key several times.

Workaround: use BindingSource as RadGridView.DataSource:

BindingSource bs = new BindingSource();
bs.DataSource = query;
this.radGridView1.DataSource = bs;
0 comments