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.

How to set a Grid header format

Thread ID:

Created:

Updated:

Platform:

Replies:

107358 Feb 26,2013 02:41 AM Mar 6,2013 03:44 AM Windows Forms 9
loading
Tags: GridControl
Andy Grau
Asked On February 26, 2013 02:41 AM

It seems to be a simple thing, but I cannot get it working... I need to change a default font of the headers (i.e. row 0 and column 0) to normal, not bold.

This code works:
Me.GridControl2(0, 1).Font.Bold = False

But this one doesn't:
Me.GridControl2.Model.ColStyles(0).Font.Bold = False
Me.GridControl2.Model.RowStyles(0).Font.Bold = False

How can I define a custom font for the whole header row or column? It is not a good idea to loop through all cells...

Thanks

Arun Kumar V [Syncfusion]
Replied On February 27, 2013 06:20 AM

Hi Andy Garu,

Thanks for your interest in Syncfusion products.

Query:

How can I define a custom font for the whole header row or column?

I could not able to reproduce the reported code doesnot respond to the particular column font. The code specified from your side itself can make the font of the particular column to be bold.  Please refer to the following image.

I have provided the sample in latest Syncfusion version so it might cause problems if you use older version due to unavailability of advanced support provided in latest version. So please provide me the version you are using, so that I can provide sample in that version.

Please let me know if you have any other concerns.

Regards,

Arun.



VB_b3b19831.zip

Andy Grau
Replied On February 27, 2013 07:34 PM

Thank you, but it doesn't work. Can you provide a sample for the 7.3 version?

Arun Kumar V [Syncfusion]
Replied On February 28, 2013 05:26 AM

Hi Andy Grau,

Thanks for the update.

Query:

sample for the 7.3 versionsample for the 7.3 version

 

I have modified the sample in the 7.3 version, as I said in my last update the below code given itself will make the font to appear as bold for particular columns text.

 

Me.gridControl1.Model.ColStyles(1).Font.Bold = True            Me.gridControl1.Model.ColStyles(2).Font.Bold = True

 

Snap:

 

Please refer to the following sample and let me know if the it help. If the issue is not solved Please give me a sample file to reproduce the reported behavior.

 

Please let me know if you have any other concerns.

Regards,

Arun.



VB_5f6daf11.zip

Andy Grau
Replied On March 3, 2013 06:22 PM

Yes, it works for any columns/rows except headers, i.e. column 0 and row 0. How can I set it up for column 0 or row 0?

Thanks

Arun Kumar V [Syncfusion]
Replied On March 4, 2013 07:16 AM

Hi Andy,

Thanks for the update.

Yes I could able to reproduce the reported in your version. So to set the header text font to bold you can handle the PrepareViewStyleInfo event.

this.gridControl1.PrepareViewStyleInfo +=

Please let me know if you have any other concerns.

Regards,

Arun.


Andy Grau
Replied On March 5, 2013 02:52 AM

Thanks, could you please provide the complete code for VB.NET?

Also, for the code optimization, would it be better just to loop through all header's cells rather than handle events?

Thanks

Arun Kumar V [Syncfusion]
Replied On March 5, 2013 07:03 AM

Hi Andy,

Thanks for the update.

Here is the codesnippet for the reported behavior in VB.

Code Snippet:

Private Sub grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)

if e.Style.CellType == GridCellTypeName.Header Then

e.Style.Font.Bold = true

End If

Please use the above code making the header text to be bold, and let me know if you have any other concerns.

Regards,

Arun.


Andy Grau
Replied On March 6, 2013 03:41 AM

Thank you, Arun. It works fine.

Arun Kumar V [Syncfusion]
Replied On March 6, 2013 03:44 AM

Hi Andy,

Thanks for the update.

We are glad to hear that the reported issue is solved in your side. If you have any other queries please create any new Incident/Forum.

Regards,

Arun.


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.

;