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

Excel Like Copypaste to clipboard in Gridgroupingcontrol

I am using Gridgroupingcontrol. I want to implement excel type cut-copy feature in the control.
When I am using this.m_adminDataGridViewControl.TableOptions.AllowSelection = GridSelectionFlags.None;
It doesn't allow to select individual cells .
When I am using

this.m_adminDataGridViewControl.TableOptions.AllowSelection = GridSelectionFlags.Any I am not able to get selected records.


1 Reply

JJ Jisha Joy Syncfusion Team August 14, 2008 10:40 AM UTC


HiSumit,

We appreciate your interest in Syncfusion Products.

If you have the inherited GridControlBase selection(GridSelectionFlags.Any), by setting the ListBoxSelectionMode to none. Then, you could use the code below to get the selected rows and the number of selected rows. The grid.TableControl.Model.SelectionChanging/SelectionChanged are the events that get triggered when doing selections.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.None;

GridTableControl tc = this.gridGroupingControl1.TableControl;
if (tc.Selections.Ranges.ActiveRange.IsRows)
Console.WriteLine("No of rows selected: {0}", tc.Selections.Ranges.ActiveRange.Height);

GridRangeInfoList rangeList = tc.Selections.GetSelectedRows(true, false);
if (rangeList.Count > 0)
{
foreach (GridRangeInfo range in rangeList)
{
for (int row = range.Top; row <= range.Bottom; ++row)
{
Console.WriteLine(this.gridGroupingControl1.Table.DisplayElements[row].ToString());
}
}
}



Cut-copy feature in the control

Please refer the following browser sample:

MyDocuments\Syncfusion\EssentialStudio\6.3.0.30\Windows\Grid.Grouping.Windows\Samples\2.0\FeaturedSamples\CutCopyPasteSample\cs


This sample allows you to perform cut, copy and paste operations with an hierarchical GridGroupingControl. In this sample, the gridgroupingcontrol is bound to an hierarchical dataset comprising of two tables. A Context Menu is associated with the grouping grid to enable the required clipboard operations.

Regards,
Jisha






Loader.
Live Chat Icon For mobile
Up arrow icon