How set the size (width) of field in Datagrid

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
 
B

Bob Barrows [MVP]

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
 
G

Guest

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>
 
E

Eliyahu Goldin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top