Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从行中选择值-RadGridView C#_C#_Radgridview - Fatal编程技术网

从行中选择值-RadGridView C#

从行中选择值-RadGridView C#,c#,radgridview,C#,Radgridview,我正在尝试获取RadGridView中选定行中的单元格值,我知道如何对DataGridView执行此操作,但无法转换代码 if (rgv_customers.SelectedCells.Count > 0) { int selectedrowindex = rgv_customers.SelectedRows.RowIndex; DataGridViewRow selectedRow = rgv_customers.Rows[selectedrowindex];

我正在尝试获取RadGridView中选定行中的单元格值,我知道如何对DataGridView执行此操作,但无法转换代码

 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);
}

上面的代码适用于DataGridView,有人知道如何将其转换为RadGridView吗?

我认为您的代码必须工作正常

您可以共享更多的代码吗,比如单元格的类型或单元格中的值


如果您的单元格
selectedRow.Cells[“Company”]
处于编辑模式,则应使用
RadGrid.ActiveEditor.Value
否则您的代码是完美的

很高兴我的回答帮助了你!请投票如果有用,它鼓励给出更多答案。