当gridview中列数很多时 列宽设置失效,这个问题怎么解决呢?

解决方案 »

  1.   

    或者你把客户端的HTML保存一下,给你们的美工看看,如何设置,然后找到程序相应的地方添加一下就可以了
      

  2.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                e.Row.Cells[i].Width = "200px";
            }
            
        }
      

  3.   

    yb1124,出错
    “从字符串“200px”到类型“Integer”的转换无效”
      

  4.   

       <HeaderStyle Width="30px" />
      

  5.   

    e.Row.Cells[i].Width 单位是Unit
    改了就好了,列过多的问题无法解决
      

  6.   

     <asp:BoundField DataField="Email" HeaderText="邮件" >
      <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
     </asp:BoundField>