<asp:BoundField DataField="xh" HeaderText="xh" Visible="false">
                                    <HeaderStyle CssClass="disTd" Width="1"></HeaderStyle>
                                    <ItemStyle CssClass="disTd"></ItemStyle>
                                </asp:BoundField>
后台
gvList.Rows[int.Parse(e.CommandArgument.ToString())].Cells[1].Text;为空?
怎样取这一列值?

解决方案 »

  1.   

    string str = e.Row.Cells[0].Text
      

  2.   

    不好意思,是在
    RowCommand(object sender, GridViewCommandEventArgs e)
    事件里
      

  3.   

    Control c = e.CommandSource as Control
    GridViewRow row = c.NamingContainer as GridViewRow;
    string text = row.Cells[1].Text;
      

  4.   

    什么啊?不解
    不能直接去绑定在gridview上面的值吗
      

  5.   

    怎么Visble为false时不能取值?
    有啥好方法取隐藏值吗?
      

  6.   

    怎么Visble为false时不能取值?好像是取不到,放HIDDEN
      

  7.   

    把隐藏的列 添加到datakey中
     从datakey获取值
      

  8.   

    把隐藏的列 添加到datakey中   取值的时候 ,可以先获取行索引
       gvList.DataKeys[index].Values["列名"].ToString();