How set the size (width) of field in Datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to set the size of a field in DataGrid?

Right now the size is automatically set and determined by the size of the
colunm name.

Thanks

David
 
david said:
How to set the size of a field in DataGrid?

Right now the size is automatically set and determined by the size of
the colunm name.
If using Visual Studio, just right-click the grid and fire up the Propery
Builder, using the Format tab to modify the Column widths.

Otherwise, add a HeaderStyle tag to the html:

<asp:BoundColumn ... >
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>

HTH,
Bob Barrows
 
This may be what you are looking for

<Columns>
<asp:BoundColumn DataField="EMPLOYEE_NUMBER"
SortExpression="EMPLOYEE_NUMBER" HeaderText=" Employee ID ">
<HeaderStyle HorizontalAlign="Center" Width="250px"
VerticalAlign="Middle"></HeaderStyle>
</asp:BoundColumn>
</Columns>
 
In addition to the other answers just note, that the browser considers your
column width instructions only as recommendations. To force the browser to
listen to you use css rule table-layout:fixed.

Eliyahu
 
Back
Top