We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Is it possible to have different selection on different rows?

Hi,
I would like to know if pssoble to set different selection types on different row.
I would like to be able to have a
A) row where only cells are selected and in same table I would like to have
B) rows that are hole row is selected and also
C) Can I have cells that can not get focus and can not be selected.

Regards
ToDo


9 Replies

AD Administrator Syncfusion Team November 30, 2007 10:30 AM UTC

You can do things like this in a GridControl and a GridDataBoundGrid. It can also be done in simple flat GridGroupingControls. But in a GridGroupingControl with nested tables where the only selection architecture supported is the Table.SelectedRecords collection, you can only have whole records selected. If you want such behavior in a arbitary GridGroupingControl, you would have to manage the whole process yourself.

Post the type of grid are you using and maybe we can post some specific code snippets if such selections are possible for your particular grid.



TO ToDo November 30, 2007 11:59 AM UTC

Hi
I'm using GridControl

Regards,
ToDo



AD Administrator Syncfusion Team November 30, 2007 01:25 PM UTC

You can use the SelectionChanging and SelectionChanged events in a GridControl to control selections. To avoid a cell accepting focus, you need to set gridControl1[row, col].Enbled = false;. Here is a little sample illustrating the use of these events.





WindowsApplication8.zip


TO ToDo December 3, 2007 10:23 AM UTC

Hi again and thanks,
That is what I would like but
A) Clicking a cell in wholeSelectedRows does not make tha row become selected.
B) It does handle click and drag but nog shift and arrow keys although the selection becomes changed.

Regards,
ToDo



AD Administrator Syncfusion Team December 3, 2007 12:16 PM UTC

Try changing the if statement to

if (e.Range != null && !e.Range.IsEmpty && (e.Reason == GridSelectionReason.MouseUp || e.Range.IsCells))


to see if that comes closer to what you need.




TO ToDo December 3, 2007 12:46 PM UTC

Hi thanks,
yes It gets me closer.
But the following does not get selected correct:
1) select 1D and use shift+ down key; row 3 does not get selected
2) select tow white cells, use arrow keys to move between selected cells: the selection should be only the cell you moved to as when you step out of the selected area.

Regards,
ToDO




AD Administrator Syncfusion Team December 3, 2007 01:50 PM UTC

Here is another example of how you can go about doing such things. To get the exact behavior you seek, you will have to tweak the code to get the behavior you want.




WindowsApplication8_2.zip


TO ToDo January 7, 2008 01:27 PM UTC

Hi again!
I need to combine this funcionality with the possibility to select multiple lines and display a popup menu that should apply to all the selected rows. The problem is that when right clicking one the clicked row gets selected.
Could you help me out with the multiline and right click combination.

Regards,
ToDo



TO ToDo January 18, 2008 02:30 PM UTC

Hi!
I really would appreciate help on this!
The myGrid_selectionChanging/Changed occurs before the myGrid_MouseDown event and the selection at right click is then lost.

How can I have this kind of selection and still get right click menu to work.

Regards,
ToDo




Loader.
Live Chat Icon For mobile
Up arrow icon