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

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Steve,

    FYI, switching to CalculateAutoResizeWidth from PerformAutoResize was not neccessary. Both of these methods take a PerformAyutoResizeType. So you could have just passed in VisibleRows into PerformAutoResize and saved yourself a step.

    Anyway... there is also an overload of PerformAutoResize which allows you to pass in an integer representing a number of rows, so you can pass in 100.

Reply Children
No Data