Hi
I'm using the mergecell function of the WinGrid to merge cells in a single column where they have the same value, and it works great. However, I sometimes need to only merge cells based on the value of another column e.g. I have a table with three columns. I am merging the third column values across rows if they have the same value. However, I only want the merge to happen when the value in the first column also matches e.g.
Column A Column B Column CPencils Apples 1Pencils Pears 1---------------------------------Pens Bananas 1Pens Pineapples 1---------------------------------Pens Grapefruit 2
In the example above, the merge is occuring on Column C. Currently, the first four rows all get merged together, but I would like the merge to only occur on what is effectively the compound key of Columns A and C - so the first two rows should be merged, three and four should be merged, and the fifth should be on its own.
Can this be accomplished in the Grid?
Hi,
Yes, I beleive you can do this using the MergedCellEvaluator property on the column. What you do is create a class that implements IMergedCellEvaluator. This interface has only one method: ShouldCellsBeMerged. The method passes in two rows and the column being merged and you return true or false to indicate whether or not to merge the cells.
Perfect
Thanks a bunch Mike.
I need to UltraWebGrid Merge Total Count below details base on Week number and different back gound colour. Any one help to me.
Date Day Count Week Number Total Count
09/07/2008 11 28 1210/07/2008 1 28 1215/07/2008 1 29 123/07/2008 7 30 1724/07/2008 6 30 1725/07/2008 4 30 1729/07/2008 17 31 17
You should post UltraWebGrid questions in the UltraWebGrid forum.