Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
490
Resizing Grid Columns
posted

Hi,

I have a need to size all of my grid's columns to the width of the header text or longest cell text... whichever value is greater.

Currently, I am looping through all of the columns in my grid and I call the following method to size each column:

 column.CalculateAutoResizeWidth(PerformAutoSizeType.VisibleRows, true)

I used to use the "PerformAutoSizeType.AllRowsInBand" parameter, but I came across a case where I had too many rows in the grid and the resize routine took too long.

The "PerformAutoSizeType.VisibleRows" parameter works, but I think this only works on the few rows at the top of the grid that are visible.  Is there a method that I can use that will base the resizing on a given number of rows in the grid... like the first 100 rows?

Thanks!

Steve