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

how to hightlight col and row range like excel did , in GGC ?

how to hightlight col and row range like excel did , in GGC ?

then how to get those ranges ... from GGC.

david


8 Replies

RC Rajadurai C Syncfusion Team March 4, 2009 04:11 PM UTC

Hi David,

Thanks for your interest in Syncfusion products.

The excel-like cell selection range can be obtained through the following code handled in TableModel.SelectionChanged event.

this.gridGroupingControl1.TableModel.SelectionChanged += new GridSelectionChangedEventHandler(TableModel_SelectionChanged);

void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
Console.WriteLine(e.Range.ToString());
}


Regards,
Rajadurai



DC David Cui March 4, 2009 07:28 PM UTC


Rajadurai,

Maybe I didn't make myself clear.

the problem is, I even can not to highlight muliple rows / columns. If i put the cusor, try to drag it. try to highlight block of grid. Somehow, it doesn't allow me to do it.

My purpose, is, use control v, control c to copy the highlighted block of the grid.

david



>Hi David,

Thanks for your interest in Syncfusion products.

The excel-like cell selection range can be obtained through the following code handled in TableModel.SelectionChanged event.

this.gridGroupingControl1.TableModel.SelectionChanged += new GridSelectionChangedEventHandler(TableModel_SelectionChanged);

void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
Console.WriteLine(e.Range.ToString());
}


Regards,
Rajadurai





RC Rajadurai C Syncfusion Team March 5, 2009 01:56 PM UTC

Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai



DC David Cui March 5, 2009 02:59 PM UTC

some how it is not working for me. can you send a simple sample ?

David


>Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai





DC David Cui March 6, 2009 06:03 AM UTC


Sorry I figured it out. seems selectionMode=One can not mixed with selectionMode = any. You can not have both.

However, when i hightlight the range, it disappeared if i do right-click context menu. Is there way to preserve the hightlight (selection) range for i do right-click to do contextMenu cmd ?

thx.


>some how it is not working for me. can you send a simple sample ?

David


>Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai







RC Rajadurai C Syncfusion Team March 6, 2009 03:11 PM UTC

Hi David,

The AllowSelection property and ListBoxSelectionMode property cannot be used together. If one is used, another property must be set to None.

The selected range can be preserved on right click through setting SelectCellsMouseButtonsMask property to MouseButtons.Left.

Please refer to the following code.

this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Rajadurai



DC David Cui March 9, 2009 03:18 PM UTC


Rajadurai, Thanks, it is really helpful info. It works for me.

Only question is, ctr c. ctr v, is automatically works Or i need to explicitly implment clipboard ... ?

David


>Hi David,

The AllowSelection property and ListBoxSelectionMode property cannot be used together. If one is used, another property must be set to None.

The selected range can be preserved on right click through setting SelectCellsMouseButtonsMask property to MouseButtons.Left.

Please refer to the following code.

this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Rajadurai





RC Rajadurai C Syncfusion Team March 10, 2009 06:10 AM UTC

Hi David,

The operation of Ctrl +C, Ctrl +V normally works with grid by default. If you need to customize the clipboard copy & paste, you can stop this default operation by setting Handled property to true in ClipboardCopy and ClipboardPaste events and your own code in it.

this.gridControl1.ClipboardCopy += new GridCutPasteEventHandler(gridControl1_ClipboardCopy);
void gridControl1_ClipboardCopy(object sender, GridCutPasteEventArgs e)
{
e.Handled = true;//cancels the default copy
//own code
}


Regards,
Rajadurai


Loader.
Live Chat Icon For mobile
Up arrow icon