如何在gridview中增加列的宽度

问题描述:

在我的Grideview2中,我想增加数据字段''reg_date''的宽度:

我尝试使用以下代码但没有成功。任何人都可以帮助我。



In my Grideview2 I wanted to increase the width of datafield column ''reg_date'':
I tried using the following code but not working out. Can anyone help me out.

<asp:GridView ID="GridView2" runat="server"  HorizontalAlign="Center"  AutoGenerateColumns="False"

               style="border-color: #808000; top: 298px; left: 515px; position: absolute; height: 75px; width: 457px"

               PageSize="3"  allowpaging="true" onpageindexchanging="GridView2_PageIndexChanging"     onselectedindexchanged="GridView2_SelectedIndexChanged" >
           <RowStyle HorizontalAlign="Center" />
           <Columns >
               <asp:CommandField ShowSelectButton="True" />
               <asp:BoundField DataField="reg_id" HeaderText="reg_id"

                   SortExpression="reg_id" />
               <asp:BoundField   DataField="reg_date" HeaderStyle-Width="120"    HeaderText="regd date"  SortExpression="reg_date"   />
               <asp:BoundField  DataField="noofitems" HeaderText="noofitems"

                   SortExpression="noofitems" />
               <asp:BoundField DataField="amtdue" HeaderText="amtdue"

                   SortExpression="amtdue" />
           <asp:BoundField DataField="eligibile_days" HeaderText="eligibile_days"

                   SortExpression="eligibile_days" />
           </Columns>
            <SelectedRowStyle BackColor="#FF6666" />
           <HeaderStyle BackColor="#99CCFF" />
           <AlternatingRowStyle BackColor="#99CCFF" HorizontalAlign="Center" />
       </asp:GridView>

请参阅以下链接



gridview中列的宽度。 />


在asp.net中设置gridview的列宽



在gridview中设置列宽
Refer to the below links

Width of column in gridview.

set column width of a gridview in asp.net

set column width in gridview