I have one GridView which has multiple columns. Here I just mentioned only the two columns in the GridView.
<asp:TemplateField HeaderText="Tot. Qty." ItemStyle-Width="30px" ControlStyle-Width="30px" >
<ItemTemplate>
<asp:Label ID="lblTotQty" runat="server" Text='<%# Bind("TotalQuantity") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="30px" />
<ControlStyle Width="30px" />
</asp:TemplateField>
<asp:BoundField DataField="UoM" HeaderText="UoM" ItemStyle-Width="25px" />
But the problem here is, when the Total Quantity column values is greater than 6 digits. then the value is displays continuously along with the next column value “UoM”.
How to increase the GridView column width of “Total Quantity” according to the Column’s value?
Why don’t you just NOT specify a width at all and let is size dynamically?
Alternative: calculate the width in code behind and set it there.