I'd like to set my WebGrid's columns width to adjust to the width of the cell text, except for the last column. I've tried setting ColWidthDefault to "" and to "0". (FWIW: I'm using AutoGenerateColumns)
Any hints?
TIA
Thanks very much. This is useful.
Thanks for the suggestion for automatic column width
And here's a screenshot of the same grid after adding the 1550px width to the last column of the last band.
(This system only displays attached images correctly if you limit it to one per post.)
Thanks, rkyllo!
Just in case anyone ever has the same issue:
My next problem was that, using the default borders, I ended up with a ragged right edge, and some missing borders. (see attached screenshot)
In my grid's .DataBound handler, I added this line:
MyGrid.Bands(3).Columns(4).Width = 1550
I would have expected this to push the right edge of the border far off the page, but all it did was clean up the ragged right edge and the "missing borders" problem.
(All of the above is using IG 6.3)
In the DisplayLayout you can set TableLayout to Auto, which will set all column widths to "as wide as it takes". This setting requires StationaryMargins set to No, and UseFixedHeaders set to False