Hi Falcon,
Thanks for the update.
By default, when data source for the grid is changed through Data source property of GridGroupingControl, the selected record will be cleared as new data source for the Grid is assigned. If you want to set position of record in a previously selected record, we can set the current cell position by make use of the previous grid’s current cell row index and column index. Please make use of the below code,
Code Example
private void button1_Click(object sender, EventArgs e)
{
int colindex, rowIndex;
colindex = this.gridGroupingControl1.TableControl.CurrentCell.ColIndex;
rowIndex = this.gridGroupingControl1.TableControl.CurrentCell.RowIndex;
if (this.button1.Text == "Update Data1")
{
this.gridGroupingControl1.DataSource = data2;
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex, colindex, GridSetCurrentCellOptions.SetFocus);
this.button1.Text = "Update Data2";
}
else
{
this.gridGroupingControl1.DataSource = data1;
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex, colindex, GridSetCurrentCellOptions.SetFocus);
this.button1.Text = "Update Data1";
}
}
Sample Link
If the provided solution doesn’t meet your requirement, please let us know.
Regards,
Amal Raj U.