如何从 DevExpress.XtraGrid.Views.Grid.GridView 获取选定对象
How to getting a selected object from DevExpress.XtraGrid.Views.Grid.GridView
我正在寻找这样的东西:
public static Object GetCellRowValue(DataGridView gridView, String columnName)
{
Object o = gridView.CurrentRow.Cells[columnName].Value;
return o != null ? o.ToString() : null;
}
public static T GetRow(DataGridView gridView)
{
T linha = (dataGridView.SelectedRows[0].DataBoundItem as T);
return linha;
}
我想用这种方式用 GridControl 做一些事情。
有获取所选值的内置方法:
object selectedCellValue = gridView1.FocusedValue;
object columnOfSelectedRow = gridView1.GetFocusedRowCellValue("ColumnName");
T selectedObject = gridView1.GetFocusedRow() as T;
有关详细信息,请参阅 Get Cell Values。
我正在寻找这样的东西:
public static Object GetCellRowValue(DataGridView gridView, String columnName)
{
Object o = gridView.CurrentRow.Cells[columnName].Value;
return o != null ? o.ToString() : null;
}
public static T GetRow(DataGridView gridView)
{
T linha = (dataGridView.SelectedRows[0].DataBoundItem as T);
return linha;
}
我想用这种方式用 GridControl 做一些事情。
有获取所选值的内置方法:
object selectedCellValue = gridView1.FocusedValue;
object columnOfSelectedRow = gridView1.GetFocusedRowCellValue("ColumnName");
T selectedObject = gridView1.GetFocusedRow() as T;
有关详细信息,请参阅 Get Cell Values。