在Rows部位提示, “GridView”不包含Rows的定义,并且找不到可接受类型为GridView的第一个参数的扩展方法(“Rows”是否缺少using指
/// <summary>
/// 合并GridView中某列相同信息的行(单元格)
/// </summary>
/// <param name="GridView1">GridView</param>
/// <param name="cellNum">第几列</param>
public static void GroupRows(GridView GridView1, int cellNum)
{
int i = 0,
rowSpanNum = 1;
while (i < GridView1.Rows.Count - 1)
{
GridViewRow gvr = GridView1.Rows[i];
for (++i; i < GridView1.Rows.Count; i++)
{
GridViewRow gvrNext = GridView1.Rows[i];
if (gvr.Cells[cellNum].Text == gvrNext.Cells[cellNum].Text)
{
gvrNext.Cells[cellNum].Visible = false;
rowSpanNum++;
}
else
{
gvr.Cells[cellNum].RowSpan = rowSpanNum;
rowSpanNum = 1;
break;
} if (i == GridView1.Rows.Count - 1)
{
gvr.Cells[cellNum].RowSpan = rowSpanNum;
}
}
}
}
想把上面这段代码 放在APP_Code里面,定义为静态方法方便调用,
在Rows部位提示, “GridView”不包含Rows的定义,并且找不到可接受类型为GridView的第一个参数的扩展方法(“Rows”是否缺少using指令或程序集引用)
在文件首部,已经添加了
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.GridView;
仍旧提示这样的错误,请问应该怎么解决???