学习:GridView中asp:BoundField的Visible=false时,无法取到这个字段的值

把asp:BoundField的Visible设置为false,肯定取不到值。

两种方法:

1。设置width=0

2。创建Row后立即隐藏。

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

原文地址:https://www.cnblogs.com/leotian/p/1398861.html