Select multiple rows in FlexGrid

Posted by: dirk.kuehnle on 15 May 2019, 8:39 pm EST

    • Post Options:
    • Link

    Posted 15 May 2019, 8:39 pm EST - Updated 3 October 2022, 4:13 pm EST

    Hello,

    I use an unbound FlexGrid with SelectionMode = ListBox.

    Now I can select multi rows by pressing Ctrl-Button and click on the rows (see attached image).

    The selected rows I can get using this.c1FlexGrid1.Rows.Selected as RowCollection.

    After reloading the Grid, the rows have to appear selected as before.

    Can you please tell me, how to reselect the rows.

    The only way I found is to use the c1FlexGrid1.Select method. This method only allows a CellRange with a sequential number of rows.

    Thanks,

    Dirk

  • Posted 16 May 2019, 6:15 pm EST

    Hi Dirk,

    set “c1FlexGrid.Rows[rowindex].Selected = true;” to restore listbox selection.

    Best regards

    Wolfgang

  • Posted 16 May 2019, 7:29 pm EST

    Hello Dirk

    As Wolfgang suggested, you may iterate the grid rows and set the Selected property to true for the rows present in grid’s Rows.Selected collection.

    Alternatively, you may use the WriteXml, ReadXml methods to save grid contents including its row selection state.

    Note: Using this approach, all the settings like Sort state, etc will also get restored.

    Thanks,

    Ruchir

  • Posted 21 May 2019, 7:16 pm EST

    Hi Wolfgang,

    thanks for your reply.

    Your suggestion works perfect for me.

    Regards,

    Dirk

Need extra support?

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

Learn More

Forum Channels