SoFunction
Updated on 2025-03-06

DevExpress implements GridControl to select a row based on the column

This article shows the practical function of DevExpress to implement GridControl to select a row based on the column. It is hoped to play a certain reference and helpful role for everyone in project development. The specific methods are as follows:

The main function codes are as follows:

/// <summary>
/// Select a row according to the column/// </summary>
/// <param name="gridView">GridView</param>
/// <param name="colName">Column name</param>/// <param name="colValue">Column value</param>public static void SelectRow(this GridView gridView, string colName, object colValue)
{
  ();
  for (int rowHandle = 0; rowHandle &lt; ; rowHandle++)
  {
 object _cellValue = (rowHandle, colName);
 if (_cellValue != null)
 {
   if (_cellValue == colValue)
   {
 (rowHandle);
 break;
   }
 }
  }
}

The code example is as follows:

<GridControl>(gc => (gcKeyFieldName, _finded.LampID));