I am looking for ideas on how to achieve the following type of selection behavior on an Ultragrid.
My grids typically have SelectTypeRow = Extended, SelectTypeCell = None and SelectTypeCol = None and the CellClickAction = RowSelect. This works well, however it's not very convenient when users want to copy values from just a few cells (not entire rows).
I want to allow users to select cells, have those cells exposed via the SelectedCells property AND have all rows that contain a selected cell also be considered selected and be exposed via the SelectedRows property. During a Copy operation I would copy the values of the SelectedCells to the clipboard. If the user wanted to copy the entire row to the clipboard, they would have to select all the cells in the row.
I know I can set the SelectTypeCell to Extended and change the CellClickAction to CellSelect, but this results in SelectedCells only (no rows are selected). I want to have a grid that can have SelectedCells and SelectedRows at the same time. Any ideas on how to achieve this type of behavior?
Hi John,
Thank you for contacting Infragistics Developer Support.
Generally the grid can’t have selected cells and selected rows at the same time. What you could do is to use SelectTypeCell to Extended and change the CellClickAction to CellSelect and then keep a collection of the rows that should be selected. You can use the BeforeSelectChange or AfterSelectChange events for this goal. This way you will have access to the selected cells and the “selected” rows at the same time.
I have attached a sample demonstrating this suggestion.
Please let me know if you have any additional questions.
Thanks Dimitar,
Your quick sample provided just what I needed to make this approach work. Your code to identify the selected rows from the selected cells is slick.
Much appreciated!
John