Reputation: 437
This is my HTML for my grid, how can I set the columns to auto-fit so that one column is not really huge when it is not needed? I know I can manually set the size, but I would rather it auto-size as some store names are longer than others and some manager names are longer than others so a pre-determined size isn't a good option.
<asp:DataGrid runat="server" ID="dtgMain" AutoGenerateColumns="false"
CssClass="DataGrids" GridLines="Both" ShowFooter="true" OnItemCommand="dtgMain_OnItemCommand">
<ItemStyle CssClass="row" />
<FooterStyle CssClass="DataGridFooters" />
<HeaderStyle CssClass="DataGridHeaders" />
<Columns>
<asp:BoundColumn DataField="storename" HeaderText="storename"></asp:BoundColumn>
<asp:BoundColumn DataField="hours" HeaderText="hours"></asp:BoundColumn>
<asp:BoundColumn DataField="Date" HeaderText="Today's Date" DataFormatString="{0:d}"></asp:BoundColumn>
<asp:BoundColumn DataField="manager" HeaderText="Store Manager"></asp:BoundColumn>
<asp:BoundColumn DataField="Owner" HeaderText="Store Owner"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
Upvotes: 0
Views: 2817