Search code examples
c#c1flexgrid

How to get specific value from c1FlexGrid?


I have c1FlexGrid on my WF with 7 columns and 10 rows. On double click I want to open another WF which is something like detail of that row, but I want to send userId value to that form. I don't know how to get that id. My code looks like this:

private void c1FlexGrid1_DoubleClick(object sender, System.EventArgs e)
{
  int rowIndex = c1FlexGrid1.Row;
  if (rowIndex != -1)
  {        
    int userId = I need value from column "UserId" on this rowIndex.
    frmUser userForm = new frmUser(userId);
    userForm.ShowDialog();
  }      
}

Any suggestion?


Solution

  • Try this (object GetData(int rowIndex, string columnName)):

    int userId = (int)c1FlexGrid1.GetData(c1FlexGrid1.RowSel, "UserId");
    

    Where RowSel is index of selected row.