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

Grid: Autosize during initiaisation

Thread ID:





49529 Sep 20,2006 06:35 PM UTC Sep 22,2006 06:20 AM UTC WinForms 3
Tags: GridControl
Andreas Gfeller
Asked On September 20, 2006 06:35 PM UTC

I''ve a problem with autosize feature in colums. When autosize is true, the column resizes perfectly when entering text in cells. So far, so good.

But there are two problems I''ve not found how to solve them:

First: When initializing a group of cells in a column, the column width does not fit to the largest text in that column. It remains at default width until I''m manually adding some text.

Second: The cell width does increase when entering text manually. But when text becomes shorter again, the width does not reduce.

How can I do this? Is Autosize the right feature implementing those things?

Thanks in advance

Administrator [Syncfusion]
Replied On September 21, 2006 07:46 AM UTC

Hi Andreas,

1. In the Form Load, call the ResizeToFit() method to make all the column widths get adjusted to its cell contents.

this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders);

2. Try the code below in the TableControlCurrentCellChanged event handler to dynamically adjust the column width while entering text.

GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(cc.RangeInfo, GridResizeToFitOptions.None);

Let me know if this helps for you.

Administrator [Syncfusion]
Replied On September 22, 2006 06:19 AM UTC

That works perfectly!

Many thanks

Andreas Gfeller
Replied On September 22, 2006 06:20 AM UTC

That works perfectly!

Many thanks


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