Search code examples
c#radgridview

Selecting value from a row - RadGridView C#


I'm trying to get the value of a cell within a selected Row in a RadGridView, I know how to do this for a DataGridView but can't convert the code.

 if (rgv_customers.SelectedCells.Count > 0)
 {
     int selectedrowindex = rgv_customers.SelectedRows.RowIndex;

     DataGridViewRow selectedRow = rgv_customers.Rows[selectedrowindex];
     string comapany = Convert.ToString(selectedRow.Cells["Company"].Value);
}

The above code works for a DataGridView, does anyone know how to convert it for a RadGridView?


Solution

  • I think your code must work fine!

    Can you share some more code, like type of the cell or value in the cell.

    If your cell selectedRow.Cells["Company"] is in edit mode than you should use RadGrid.ActiveEditor.Value otherwise your code is perfect!