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

Autosize column headers

Thread ID:





78128 Dec 1,2008 11:52 AM UTC Dec 15,2008 12:56 PM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On December 1, 2008 11:52 AM UTC

I want to column headers size is changing due GridControl size. Is it possible? Could you help me?

Nisha Arockiya A [Syncfusion]
Replied On December 2, 2008 12:41 PM UTC

Hi Dmitry,

Thanks for your interest in Syncfusion Products.

The style AutoSize property only works as your user types text into a cell. If AUtoSize is et to true for a cell, the cell will grow as your user types longer words.

To programmatically size a column, you use the GridControl.ColWidths.ResizeToFit method. (Or, GridDataBoundGrid.Model.ColWidths.ResizeToFit).
So, after setting your titles, try code such as:

this.grid.ColWidths.ResizeToFit(GridRangeInfo.Row(0), GridResizeToFitOptions.None);

to resize row zero which are the column headers.

Let me know if this is not what you needed.


Administrator [Syncfusion]
Replied On December 11, 2008 12:26 PM UTC


Thank you for your answer.
But I want to change column size in automatic mode when grid change its size. For example:
We have a Form and one GridControl on it.
GridControl.DockStyle = DockStyle.Fill.
Grid control has 3 columns: col1, col2, col3.
When user changes size of this form, size of grid control is changed either.
I want that col2 size and col3 size are not changed but col1 must fill all free space in grid control.


col1 | col2 | col3 |
------+--------+-------+ -> user sizes form
| | |


col1 | col2 | col3 |
| | |

Administrator [Syncfusion]
Replied On December 11, 2008 12:29 PM UTC

I mean:



after user changes the form:


Nisha Arockiya A [Syncfusion]
Replied On December 15, 2008 12:56 PM UTC


Thanks for being patience.

The GridControl.ColWidths.ResizeToFit method (or GridDataBoundGrid.Model.Colwidths.ResizeToFit) will resize a range of cells to fit.

To give an idea, inorder to resize the header is column 2, you would use something like


To resize all of column 2, you would use something like


Please try and let me know any help you need.


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