Thursday, 15 February 2007

Stubborn Gridview

I have a massive grid view (its an excel import) and I needed to make it so that one of the columns didn't word wrap. Setting the width made no difference. I found one solution, and a colleague pointed out another (better) solution:

  1. Convert the column into a template column. This respects the column width property, and works!
  2. Explicitly set the width of the gridview. The grid view only ignores the column width because it tries to make the grid as small as possible to fit as much on the screen. If you set the width high enough to fit all the data it shouldn't word wrap anything.



No comments: