<table style="width:600px">
    <tr>
        <td>
            <asp:GridView ID="GridView1" runat="server" Width="587px" 
                AutoGenerateColumns="False">
             <Columns>
            <asp:BoundField DataField="id" HeaderText="编号" >
                <ControlStyle Width="350px" />
                 </asp:BoundField>
            <asp:BoundField DataField="title" HeaderText="标题" />
            <asp:BoundField DataField="content" HeaderText="内容" >
                 <ControlStyle Width="20px" />
                 </asp:BoundField>
          </Columns>
            </asp:GridView>
        </td>
    </tr></table>我希望放在600px表格里的这个控件的三列按不同的自定义列宽显示可用ControlStyle Width="20px" 的方法去设置,发现显示上没有效果
请问应该怎么做让其三个列宽窄不一样

解决方案 »

  1.   

    <asp:BoundField DataField="content" HeaderText="内容" >
        <HeaderStyle Width="20px" />
    </asp:BoundField>
      

  2.   

    <HeaderStyle Width="20px" />
      

  3.   

    <HeaderStyle Width="350px" />
      

  4.   

    能额外解释一下ControlStyle Width="20px" 用途吗,我额外给分
      

  5.   

    设置了ControlStyle Width属性一般还要设置你类容的长度,内人太多同样会被撑大,一般要截取一段长度,还要设置文字自动换行,这个用css来做
      

  6.   

    gridview有自己的宽,绑定的列也有自己的宽
    而且,如果gridview包在div或者table里面的话,外面的宽是会影响gridview的