我需要设置第一列宽度的最大尺寸,但它没有设置。同时将更多数据扩展。
<div style="width:640px">
<table style="width:640px">
<asp:GridView ID="gvChallan" runat="server" AutoGenerateColumns="false" HeaderStyle-BackColor="#cccccc" Width="646px" >
<HeaderStyle Width="222px" />
<Columns>
<asp:BoundField DataField="itemsdescription" HeaderText="Items/ Description" HtmlEncode="false" HeaderStyle-Width="222px" />
<asp:BoundField DataField="Quantity" HeaderText="QTY" ItemStyle-Width="10%" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="center" />
<asp:BoundField DataField="TotalBoxes" HeaderText="Total Boxes" ItemStyle-Width="10%" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="center" />
</Columns>
</asp:GridView>
</table>
</div>
最佳答案
使用 HeaderStyle-Width
而不是 ItemStyle-Width
如下所示。还设置 Grid 本身的全宽
<asp:BoundField DataField="itemsdescription" HeaderText="Items/ Description" HtmlEncode="false" HeaderStyle-Width="222px" />
关于c# - gridview 列宽未在绑定(bind)字段中的 asp.net 中设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35504176/