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.
Unfortunately, activation email could not send to your email. Please try again.

Merge Column Headers

Thread ID:

Created:

Updated:

Platform:

Replies:

61699 May 31,2007 02:02 AM Jun 4,2007 07:30 PM Windows Forms 2
loading
Tags: GridControl
Richard Bysouth
Asked On May 31, 2007 02:02 AM

Hi

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?

thanks

Richard

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

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,
Haneef

Richard Bysouth
Replied On June 4, 2007 07:30 PM

Haneef

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".

Richard

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.

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.

;