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

Merge rows in GDBG based on range merged in previous column

Thread ID:





93190 Mar 2,2010 06:27 PM UTC Mar 29,2010 12:38 PM UTC WinForms 5
Tags: GridControl
Andrew Lien
Asked On March 2, 2010 06:27 PM UTC


I am working with a GridDataBoundGrid and I am wondering how to merge similar rows in a column in a "tiered" fashion, i.e. similar values in column 1 are merged, then similar values in column 2 are merged but ONLY if they are within the range of merged values in column 1, etc., etc.

A "before-and-after" example is attached, showing what I have displayed currently and what kind of display I want afterward.

Is there any functionality already in place that achieves this effect? Otherwise, what methods will help achieve this effect?

Thanks in advance.


Rajadurai C [Syncfusion]
Replied On March 4, 2010 03:49 PM UTC

Hi Andrew,

Thanks for your interest in Syncfusion Products.

In GridDataBoundGrid, to achieve the layout mentioned in the excel sheet attached, you can make use of the CoveredRanges method for merging the cells.

To retain the covered range based on the changes handled at runtime, QueryCoveredRange event can be handled. Here is a sample for your reference in which similar kind of layout has been achieved in GridGroupingControl.


Andrew Lien
Replied On March 4, 2010 06:58 PM UTC

Thank you for the quick response.

Now that I know to use CoveredRanges method to get the range of cells covered, I can use this GridRangeInfo object.

What I would like to know now is if there is a way to merge similar rows in a column only for a limited range of rows, such as the height of the GridRangeInfo object that is returned by the CoveredRanges method?


Rajadurai C [Syncfusion]
Replied On March 5, 2010 05:38 PM UTC

Hi Andrew,

Thanks for your update.

To deal with merging of cells in a single column or a single row, the MergeCell property of the respective one too, has to be set. Please try the following code.

this.gridDataBoundGrid1.Model.Options.MergeCellsMode = GridMergeCellsMode.SkipHiddencells | GridMergeCellsMode.OnDemandCalculation | GridMergeCellsMode.MergeRowsInColumn;
this.gridDataBoundGrid1.Model.ColStyles[2].MergeCell = GridMergeCellDirection.RowsInColumn;
this.gridDataBoundGrid1.Model.RowStyles[2].MergeCell = GridMergeCellDirection.ColumnsInRow;


Andrew Lien
Replied On March 19, 2010 05:03 PM UTC


I don't think I was clear enough before.

I think what I am trying to get at is if it is possible to merge cells for only a portion of a column, instead of having the cells automatically merge for the entire column. The same goes for rows.

The code you provided seems to only do automatic merges.

I looked at my example again, and I noticed that these automatic merges would do the same, except in the bottom right portion with all of the "3" values. In automatic merging, all of these values would merge together; however, in my implementation they will not because they are each part of a separate "group". This is shown by the previous column values "1, 2, 3".

To summarize, since each "3" value belongs to the value in the previous column, they will only merge "within" the range of the previous column. Another way to think about it would be a child-parent relationship, where any given column is a parent of the next column, as well as a child of the previous column.

I hope this clears up what I am trying to do.

Thank you.

Rajadurai C [Syncfusion]
Replied On March 29, 2010 12:38 PM UTC

Hi Andrew,

I regret for the delay caused in getting back to you.

Merge functionality in Syncfusion Grid follows the standard behavior, in which customization as mentioned(restricting merging to only certain rows) when applied, will affect its generic behavior.

Hence, in such cases, it is preferable to make use of CoveredRanges method and based on the condition at runtime, handle the same in QueryCoveredRange event.



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