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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataGridColumns created at run time don't auto fit initialy

Thread ID:





4545 May 18,2003 03:36 PM UTC May 18,2003 06:45 PM UTC WinForms 1
Tags: GridControl
Merwan bachiri
Asked On May 18, 2003 03:36 PM UTC

Hi, I am trying to use a single GridDataBoundGrid to display the result of queries to different tables. I have created an array of GridBoundColumn for each type of query and depending of the query the user is issuing, the appropriate GridBoundColumn[] is loaded in the grid with "this.myGrid.GridBoundColumns.AddRange(myColumns)". The first time the grid is displayed, the column header shows the header text wrapped (ex: "my first header" is shown as "my First" and "header" on a second line). If I issue the same query again, the column then resizes and shows the whole text header on a single line...

Administrator [Syncfusion]
Replied On May 18, 2003 06:45 PM UTC

You can explicitly autosize things by: 1) set this.myGrid.AllowResizeToFit = false; to turn off the grid's auto resizing (so your explicit resizing will not be stepped upon). 2) After setting the data into the grid, call this.myGrid.Model.ColWidths.ResizeToFit(GridRangeInfo.Row(0), GridResizeToFitOptions.IncludeHeaders);


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

Live Chat Icon For mobile
Live Chat Icon