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

How to let column width to fit Column detail?

Thread ID:





6179 Aug 3,2003 10:54 PM UTC Aug 4,2003 05:18 AM UTC WinForms 1
Tags: GridControl
Asked On August 3, 2003 10:54 PM UTC

I should set which Property?

Administrator [Syncfusion]
Replied On August 4, 2003 05:18 AM UTC

If you are using a GridDataBoundGrid, the default behavior is to size columns based on the headertext. To turn off this default behavior so you can explicitly size the columns differently, you must set: this.grid.AllowResieToFit = false; Then to actually cause the column widths to rezie to to the text, you call this.grid.Model.Cols.ResizeToFit, passing in the range you want to resize, as well as options like whether to include the headers in teh resizing, or to allow the colsize to shrink. this.grid.Model.Cols.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders); will resize everything. Please note that is you have many, many rows, this may take some time, and you might want to just resize teh visible rows: Me.Grid.Model.RowHeights.ResizeToFit(GridRangeInfo.Rows(Me.GridDetail.TopRowIndex, Me.Grid.ViewLayout.LastVisibleRow), GridResizeToFitOptions.None)


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