读书人

gridviw Cell有关问题

发布时间: 2011-12-14 23:20:17 作者: rapoo

gridviw Cell问题

for (int i = 0; i < this.grv_kecheng.Rows.Count; i++)
{
//课程从第一门开始循环

GridView rowi = this.grv_kecheng.Rows[i];//取得当前行,即首行
string kecheng = rowi.Cells[0].Text.ToString();
Response.Write(rowi);
}



错误:“System.Web.UI.WebControls.GridView”并不包含“Cells”的定义
有时候可以运行成功,有时候不成功,是什么原因呢?是命名空间没有使用吗?cells使用什么命名空间呢?

[解决办法]
GridView rowi = this.grv_kecheng.Rows[i];//取得当前行,即首行

===========> GridViewRow rowi = this.grv_kecheng.Rows[i];//取得当前行,即首行

读书人网 >asp.net

热点推荐