Flexgrid get rows without details

Posted by: kisar on 5 September 2021, 11:48 pm EST

    • Post Options:
    • Link

    Posted 5 September 2021, 11:48 pm EST

    Hi, im working with a flexgrid and RowDetails

    How is it possible get only the “main” rows ?

    I noticed that the Rows contains all rows, “main” and details all together,

    this creates me some problems,

    • to select a specific row index
    • count how many “main” rows are in the flexgrid

    Thanx

  • Posted 6 September 2021, 4:10 pm EST

    Hi,

    JFYI, FlexGrid containing row details uses RowWithDetails class to display parent row & the child row is displayed using DetailRow class.

    So, you can get all the main rows from FlexGrid as follows:

    foreach(var row in grid.Rows)
    {
          if (row is RowWithDetails)
          {
               // main row
          }
    }
    

    And for selecting main rows you can set FlexGrid’s SelectedIndex as follows:

    
    int selectionRowIndex = (int)num.Value;
    if (selectionRowIndex < 0)
       MessageBox.Show("Row index shouldn't be negative");
    else if ((grid.Rows.Count / 2)-1 < selectionRowIndex)
       MessageBox.Show("Entered value should less than the no. of main rows in grid");
    else
    grid.SelectedIndex = selectionRowIndex;
    

    Please refer the attached sample for the same : FlexgridRowDetailsDemo.zip

    Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels