I would like to have fixed column widths on a grid and not allow a row to wrap onto multiple lines. The way I've achieved this is to:-
1. Set TableLayout="Fixed"
2. Set fixed sizes in the ColumnCreated event...
If (TypeOf e.Column Is GridBoundColumn) Then
CType(e.Column, GridBoundColumn).HeaderStyle.Width = 140
CType(e.Column, GridBoundColumn).DataFormatString = "<nobr>{0}</nobr>"
End If
3. Apply a CSS Class to ItemStyle and AlternatingItemStyle...
<ItemStyle CssClass="grid-row" />
<AlternatingItemStyle CssClass="grid-row" />
4. My CSS Class is defined as follows...
.grid-row td {overflow:hidden;}
Is this the best way to achieve this or is there a built in way or preferred way?
Thanks
1. Set TableLayout="Fixed"
2. Set fixed sizes in the ColumnCreated event...
If (TypeOf e.Column Is GridBoundColumn) Then
CType(e.Column, GridBoundColumn).HeaderStyle.Width = 140
CType(e.Column, GridBoundColumn).DataFormatString = "<nobr>{0}</nobr>"
End If
3. Apply a CSS Class to ItemStyle and AlternatingItemStyle...
<ItemStyle CssClass="grid-row" />
<AlternatingItemStyle CssClass="grid-row" />
4. My CSS Class is defined as follows...
.grid-row td {overflow:hidden;}
Is this the best way to achieve this or is there a built in way or preferred way?
Thanks
