DevExpress GridControl实现根据RowIndex和VisibleColumnsIndex来获取单元格值

本文实例展示了DevExpress GridControl实现根据RowIndex和VisibleColumnsIndex来获取单元格值的方法,具体如下所示:

主要功能代码如下:

/// <summary>
/// 根据rowIndex和visibleColumnsIndex来获取单元格可见值
/// </summary>
/// <param name="view">GridView</param>
/// <param name="rowIndex">rowIndex</param>
/// <param name="visibleColumnsIndex">visibleColumnsIndex</param>
/// <returns>单元格可见值</returns>
public static string GetRowCellDisplayText(this GridView view, int rowIndex, int visibleColumnsIndex)
{
  return view.GetRowCellDisplayText(rowIndex, view.VisibleColumns[visibleColumnsIndex]);
}
/// <summary>
/// 根据rowIndex和visibleColumnsIndex来获取单元格值
/// </summary>
/// <param name="view">GridView</param>
/// <param name="rowIndex">rowIndex</param>
/// <param name="visibleColumnsIndex">visibleColumnsIndex</param>
/// <returns>单元格值</returns>
public static object GetRowCellValue(this GridView view, int rowIndex, int visibleColumnsIndex)
{
  return view.GetRowCellValue(rowIndex, view.VisibleColumns[visibleColumnsIndex]);
}

希望本文所述代码对大家有所帮助!