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

Dynamically setting Header Row Size

Thread ID:





16826 Jul 26,2004 06:59 AM UTC Jul 26,2004 07:24 AM UTC WinForms 1
Tags: GridControl
Asked On July 26, 2004 06:59 AM UTC

Hi I have a grid which has different length Column header names.Intially, when the grid is loaded all the columns get clustered and i have manually resize each column to view the contents. Also I cannot set the height and width of each column as there are more than 100 column on the grid.To avoid this i have used the following steps : 1. Created a range of all cells in Column header row. 2.Used RowHeights.ResizeToFit property. Code: >>Syncfusion.Windows.Forms.Grid.GridRangeInfo objGridInfo = new >>Syncfusion.Windows.Forms.Grid.GridRangeInfo(); objGridInfo =dgAnalysis.Model.Rows.CreateRangeFromTo(0,0); >>dgAnalysis.Model.RowHeights.ResizeToFit(objGridInfo,Syncfusion.Windows.Forms.Grid.GridResizeToFitOptions.IncludeHeaders) ; But this code does not work always. Can you suggest what is wrong in this code. And also if something else that i can try to solve the problem.

Administrator [Syncfusion]
Replied On July 26, 2004 07:24 AM UTC

If this is a GridDataBoundGrid, in formload, also set grid.AllowResizeToFit = false. The reason is that if this is not set, the grid will try to set the colwidths itself, and this can ''step on'' the explicit sizing you want to do. Not that I think it will make a difference, but you do not have to use a new operator to generate a GridRangeInfo object as the class has Static constructors that simpleify things in this respect. This single line can replace all teh code you listed. grid.Model.RowHeights.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