Note: as a result ArgumentException is thrown when accessing a cell value.
To reproduce:
private DataTable dt;
private GridViewRowInfo selectedRow;
public Form1()
{
InitializeComponent();
PopulateGrid();
PopulateGrid();
}
private void PopulateGrid()
{
dt = new DataTable();
dt.Columns.Add("Version No", typeof(Int32));
DataRow dr = dt.NewRow();
dr["Version No"] = 2385;
dt.Rows.Add(dr);
this.radGridView1.DataSource = dt;
MessageBox.Show(selectedRow.Cells[0].ColumnInfo.Name);
MessageBox.Show(selectedRow.Cells[0].Value.ToString()); //This will error on the second time through
}
private void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
//This event is not firing on the second population of the grid in the new Telerik version.
//In the old version, it did
if (!this.radGridView1.CurrentRow.IsSystem && !this.radGridView1.CurrentRow.HasChildRows() && this.radGridView1.CurrentRow.Cells.Count > 0)
selectedRow = this.radGridView1.CurrentRow;
}
Workaround: use the RadGridView.CurrentRow property directly when accessing the cell value.