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 Column Headers

Thread ID:





61699 May 31,2007 06:02 AM UTC Jun 4,2007 11:30 PM UTC WinForms 2
Tags: GridControl
Richard Bysouth
Asked On May 31, 2007 06:02 AM UTC


I'm currently evaluating Essential Grid (and am very impressed! Looks like we'll replace our existing grid control)

I'm having trouble getting merged column headers to work. Have been using the following code:

'merge and centre the column headers
With Me.GridControl1
.Model.Options.MergeCellsMode = GridMergeCellsMode.MergeColumnsInRow

'specify no merging for Standard style
.BaseStylesMap("Standard").StyleInfo.MergeCell = GridMergeCellDirection.None

'specify merging for Column Headers style
.BaseStylesMap("Col Header").StyleInfo.MergeCell = GridMergeCellDirection.ColumnsInRow

End With

'After this, I load data from a DataTable using PopulateValues (this works fine with merging turned off)

However the merging code must fail somewhere because when it later gets to:
Me.GridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cols(0, Me.GridControl1.ColCount - 1))

...I get a NullReferenceException. Not sure what exactly is raising that though! The grid shows no rows or columns after this.

Any ideas what's wrong here?



haneefm [Syncfusion]
Replied On May 31, 2007 06:25 PM UTC

Hi Richard,

You can try enabling the GridMergeCellsMode.OnDemandCalculation flag in a MergeCellsMode property. Please try the suggestion and let me know if this helps.

Me.GridControl1.Model.Options.MergeCellsMode = Syncfusion.Windows.Forms.Grid.GridMergeCellsMode.OnDemandCalculation Or Syncfusion.Windows.Forms.Grid.GridMergeCellsMode.MergeColumnsInRow

Best regards,

Richard Bysouth
Replied On June 4, 2007 11:30 PM UTC


Thanks very much - that works perfectly!

I noticed there was also a typo in my code - the style name should have been "Column Header", not "Col Header".



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