GridView BoundField Width

  • Thread starter Thread starter mohaaron
  • Start date Start date
M

mohaaron

Why does it seem like is impossible to set the width of a BoundField
in a GridView. I've tried all sorts of different way to set the width
and none of them work. So far the only thing I've done that has worked
is to set the Wrap property to false which is not what I want do.

Can anyone tell me now to set the column width of a GridView in the
aspx file code?
 
This works in a DetailsView so I think it should in a GridView:
<asp:BoundField DataField="YourFieldName" HeaderText="Your Field
Label" SortExpression="YourFieldName" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
 
I just tried the following and it doesn't work.

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
 
Back
Top