可以通过在GridView的列中添加ItemStyle来设置列宽,例如:

<asp:GridView ID="GridView1" runat="server"> <asp:BoundField DataField="Column1" HeaderText="列1" ItemStyle-Width="100px" /> <asp:BoundField DataField="Column2" HeaderText="列2" ItemStyle-Width="150px" /> <asp:BoundField DataField="Column3" HeaderText="列3" ItemStyle-Width="200px" /> </asp:GridView>

在ItemStyle-Width中设置列宽,单位可以是px或em。

aspGridView ID=GridView1 runat=server绑定的DataTable共有3列如何设置列宽

原文地址: https://www.cveoy.top/t/topic/bEWB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录