Copy & Paste Hierarchial Data

Hey there,

I have a GridGroupingControl that I am currently displaying hierarchial data in. I have multiple Departments with numerous Items under each. I want to be able to right click the grid and copy the whole grid's worth of data so that a user can then paste it into something else, like Excel.

I'm currently using a snippet of code, shown below.

GridRangeInfo range = GridRangeInfo.Cells(1, 2, TableModel.RowCount, TableModel.ColCount);
GridRangeInfoList rangeList = new GridRangeInfoList();
rangeList.Add(range);
TableModel.GroupingControl.GetTableControl("Store_Order_Details").Model.RowCount, TableModel.GroupingControl.GetTableControl("Store_Order_Details").Model.ColCount);
TableModel.CutPaste.CopyTextToClipboard(rangeList);

This works fine when the grid isn't displaying hierarchial data, but as soon as it does, the results from the Copy & Paste only include the Department level data while the Item level data is replaced by spaces.

Is it possible to achieve this and how?


TIA,

Brian R

1 Reply

AD Administrator Syncfusion Team June 3, 2009 02:47 PM UTC

You would have to recursively loop through each record and its child tables to get at all the data displayed in a hierarchical grid. Attached is a minimal sample that does this.



GGC_NestedTables_c5cc6854.zip

Loader.
Up arrow icon