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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is it possible to have different selection on different rows?

Thread ID:





70183 Nov 30,2007 10:08 AM UTC Jan 18,2008 02:30 PM UTC WinForms 9
Tags: GridControl
Asked On November 30, 2007 10:08 AM UTC

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.


Administrator [Syncfusion]
Replied On 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.

Replied On November 30, 2007 11:59 AM UTC

I'm using GridControl


Administrator [Syncfusion]
Replied On 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.


Replied On 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.


Administrator [Syncfusion]
Replied On 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.

Replied On 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.


Administrator [Syncfusion]
Replied On 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.


Replied On 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.


Replied On January 18, 2008 02:30 PM UTC

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.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon