问题:当我把asp:BoundField的Visible属性设置为false时,我在CS代码里无法取到这个字段的值。代码如下:
foreach (GridViewRow row in gvAccountList.Rows)
{
    string userId = row.Cells[1].Text.Trim();
    .......
}
当Visible属性为true时能取到。
请问有什么解决方法能在Visible为false时我CS里也能取到值?
在线等!
说明下:我现在必须要用GridView控件

解决方案 »

  1.   

    用width=0或者绑定hidden控件
    Visible=false肯定取不到
      

  2.   

    但为什么DataGrid控件就能取到呢?
      

  3.   

    就是DataGrid控件,不要用Visible=false,
    把不显示的列宽度width=0
      

  4.   

    TO:yuki_angel:您说得width=0是无效的。
      

  5.   

    or
    protected   void   GridView1_RowCreated(object   sender,   GridViewRowEventArgs   e) 
    {
    e.Row.Cells[0].Visible   =   false; 
    e.Row.Cells[1].Visible   =   false; 
    e.Row.Cells[2].Visible   =   false; 
    ......

    不过这样隐藏多列比较麻烦
      

  6.   

    width=0时候visible为true么?
    不是还是false吧