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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Need to Merge columns in GridGroupControl (VB)

Thread ID:

Created:

Updated:

Platform:

Replies:

132808 Sep 22,2017 07:50 AM UTC Sep 25,2017 12:01 PM UTC WinForms 1
loading
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.   
   
Suggestion1:   
   
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   
   
   
   
Suggestion2:   
   
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   
   
   
   
Regards,   
Arulpriya   


CONFIRMATION

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.

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

;