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

Need to Merge columns in GridGroupControl (VB)

Thread ID:





132808 Sep 22,2017 07:50 AM UTC Sep 25,2017 12:01 PM UTC WinForms 1
Tags: GridGroupingControl
Dhairya Joshi
Asked On September 22, 2017 07:50 AM UTC

Hi Experts,
I've one GGC for which i want to merge some specific columns, please check following data that I am getting from Database.

I tried the documentation which is given for merging and i tried following code.

Private Sub TestSyncGrid_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        dgv.TableDescriptor.Appearance.AnyRecordFieldCell.MergeCell = dgv.TableDescriptor.Appearance.AnyRecordFieldCell.MergeCell = GridMergeCellDirection.Both
        dgv.TableModel.Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation Or GridMergeCellsMode.MergeRowsInColumn
        dgv.TableModel.Options.MergeCellsLayout = Syncfusion.Windows.Forms.Grid.GridMergeCellsLayout.Grid

    End Sub

Basically I want it to be look like following screen

except itemname,itemamount and sizetype i want rest of the columns to be merged like MergeCellsInColumn

Please check the code and advice,
Thank You,
Dhairya Joshi

Arulpriya Ramalingam [Syncfusion]
Replied On September 25, 2017 12:01 PM UTC

Hi Dhairya,   
Thanks for your interest in Syncfusion products.   
We could understand your scenario. In order to restrict the merging for a particular column, the MergeCellDirection of the column can be set to none by using the MergeCell property of GridStyleInfo. We have created a simple sample as per your scenario. Please make use of below code and sample,   
Code example:  
'To merge the cells   
Me.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.MergeCell =GridMergeCellDirection.Both   
'To restric for particular column   
Me.gridGroupingControl1.TableDescriptor.Columns("ItemName").Appearance.AnyRecordFieldCell.MergeCell = GridMergeCellDirection.None   
Me.gridGroupingControl1.TableDescriptor.Columns("Item").Appearance.AnyRecordFieldCell.MergeCell =GridMergeCellDirection.None   
Me.gridGroupingControl1.TableModel.Options.MergeCellsMode =GridMergeCellsMode.OnDemandCalculation Or GridMergeCellsMode.MergeRowsInColumn   
Me.gridGroupingControl1.TableModel.Options.MergeCellsLayout = GridMergeCellsLayout.Grid   
'To align the cellvalue of merged cells at center   
Me.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.VerticalAlignment =GridVerticalAlignment.Middle   
The merging can also be added to some specific columns by using the MergeCell property of GridStyleInfo and the MergeCellDirection can be set as both. Please refer to the below UG link,   
Code example  
'To merge the cells of a particular column   
Me.gridGroupingControl1.TableDescriptor.Columns("Name").Appearance.AnyRecordFieldCell.MergeCell = GridMergeCellDirection.Both   


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