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

HIghlighing a row in the GridGroupingControl

Hi,

I use a GridGroupingControl version 4.2.0.60 in a .NET windows application.

I inteend to achieve the following the behaviour in the grid:
1) Click on a cell--> the entire row is highlighted
2) Click on a cell of a different row--> the previous row's highlighting is lost and the new row is highlighted.
3) Click on a non-editable cell and drag the mouse button to a few other non-editable cells of the same/different row --> The selected cells are highlighted.

By seting the following properties, I am able to highlight a row when a cell is clicked. But I am not able to select a range of records by dragging a mouse over a few rows of the grid.

grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;

grid.TableOptions.SelectionBackColor = SystemColors.Highlight(blue);
this.grid.TableOptions.SelectionTextColor = SystemColors.HighlightText(white);

grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;

grid.TableOptions.ListBoxSelectionCurrentCellOptions = GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell;

grid.TableOptions.AllowSelection = GridSelectionFlags.Any

Please let me know if I need to set any other properties to achieve the desired behaviour.

Regards,
Manjula


8 Replies

AD Administrator Syncfusion Team March 23, 2007 05:06 PM UTC

Hi Manjula,

The GridGroupingControl has two types of selection mode.

Type 1: Row based selection
This selection support can be turned on by setting the grid.tableOptions.AllowSelections to something other than None. This selection functionality raises events like the grid.TableModel.SelectionChanging/Changed.

[c#]
this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(3));

Type 2: Record based selection
This selection support is turned on by setting the grid.TableOptions.AllowSelections to None and setting the grid.TableOptions.ListBoxSelectionMode to something other than None.

[c#]
this.gridGroupingControl1.Table.SelectedRecords.Add(record);

Please refer to the following KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

For Cell Drag and Drop:
The grouping grid currently has no support for the CELL drag and drop functionality. The work around to handle the TableControlMouseDown event and call the DoDrag method to enable the drag and drop functionality in a cell. The attached sample implements the cell drag and drop functionality and also highlights the cell when the mouse move over it.

Best regards,
Haneef


MB Manjula Boudannavar March 26, 2007 03:19 AM UTC

Hi,

Thanks for your response. I got the point but I want to have both the selection types. I want to select the whole record when the cell is clicked and also selecting number of records by dragging the mouse over grid and operate on them. Please tell me what properties can be set to have both the selection types.

Setting grid.tableOptions.AllowSelections to something other than None and grid.TableOptions.ListBoxSelectionMode to none allow us to select range of records. But can't highlight whole the record when a single cell is clicked.Let me know which property I can set to have Record Based selection having the above properties set.

Or can you send me the sample which can do above mentioned selections.

Regards,
Manjula.


RA Rajagopal Syncfusion Team March 26, 2007 07:29 PM UTC

Hi Manjula,

There are two types of selection modes available for gridgroupingcontrol ( record based selection and inherited GridControlBase selection). You can't have both selection modes turned on at the same time.

For your requirement you can have the record based selection of the grid. Please use the below property settings to get the intended behavior.

grid.TableOptions.AllowSelection = GridSelectionFlags.None;
grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;

Let us know if you need any further help.
Regards,
Rajagopal


MB Manjula Boudannavar March 27, 2007 07:59 AM UTC

Hi,

If I set grid.TableOptions.AllowSelection = GridSelectionFlags.None; the grid will not allow me to drag the mouse over the grid and select the range of records. I also want to have record based selection. Can you suggest me any approach to have both of the selection at the same time.

Regards,
Manjula.


RA Rajagopal Syncfusion Team March 28, 2007 02:04 AM UTC

Hi Manjula,

You cannot expect both the selection modes to work at the same time. Even with the record based selection, you should be able to select a range of records with out any problem.

Here is a sample showing this
http://www.syncfusion.com/Support/user/uploads/GGC_SelectionExample_70cf5922.zip

Also refer this knowledge base article for more details on GridGroupingControl selection types.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Let us know if you are doing something different in your application.
Regards,
Rajagopal



MB Manjula Boudannavar March 28, 2007 11:13 AM UTC

Hi Raj,

I saw the sample. Setting the property grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended will allow Dragging the mouse over the grid and selects whole of the records.That is not selection what I want. I need to select range of cells not the records. and I want to have record based selection also.
Please suggest.

Best Regards,
Manjula.


MB Manjula Boudannavar April 5, 2007 09:34 AM UTC

Hi,

Do you have any solution. Please let me know.

Regards,
Manjula.

Loader.
Live Chat Icon For mobile
Up arrow icon