How do you control the column width in a gridview control in ASP.NET 2.0?
+1
A:
I do it using the header style for the column:
<asp:BoundField HeaderText="Name" DataField="LastName">
<HeaderStyle Width="20em" />
</asp:BoundField>
NYSystemsAnalyst
2008-11-21 19:19:27
+2
A:
You can use the HeaderStyle-Width, ItemStyle-Width or FooterStyle-Width properties. These can be applied to all the columns or per-column basis.
<asp:GridView ID="GridView1" runat="server">
<HeaderStyle Width="10%" />
<RowStyle Width="10%" />
<FooterStyle Width="10%" />
<Columns>
<asp:BoundField HeaderText="Name" DataField="LastName"
HeaderStyle-Width="10%" ItemStyle-Width="10%"
FooterStyle-Width="10%" />
</Columns>
</asp:GridView>
achinda99
2009-02-13 14:31:24