Hi,
I'm using webGrid and I would like the column width to be scaled to fit it's content or header (the biggest string).
meaning I don't want all of the columns to have uniform width but to match it's content or header.
Thanks
Maya
Intel
So long as your grid's DisplayLayout.TableLayout is set to Auto, then columns will increase their size to fit their content in this way, just as it would for an HTML table. They won't decrease in size, however.
If your DisplayLayout.TableLayout is set to Fixed, then this won't occur, nor do I know of a way to auto-size columns in this fashion. Again, this is the same for an HTML table. This is important to note because a Fixed table layout is required if you're using either stationary margins or fixed column headers.
It is set to Auto, but the columns' width is fixed
That doesn't sound like correct behavior.
What browser are you using? What have you set your column's width to, and what's the longest string in your column (header or data)?
OK...
The colWidthDefault was set to 100px by default.
I put null instead and now it works fine.
Thanks a lot