【发布时间】:2011-08-06 19:01:41
【问题描述】:
我在 gridview 中使用复选框..获取复选框 id 我正在使用以下代码..
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chkDelete = (CheckBox)GridView1.Rows.Cells[0].FindControl("chkSelect");
if (chkDelete != null)
{
if (chkDelete.Checked)
{
strID = GridView1.Rows.Cells[1].Text;
idCollection.Add(strID);
}
}
}
但是关键字“CELLS”..不支持..我收到一个错误..“System.Web.UI.WebControls.GridViewRowCollection'不包含'Cells'的定义”
【问题讨论】:
-
我不知道你为什么要循环语句,因为你正在硬编码单元格的值,比如单元格 [0] 和单元格 [1] 如果你需要其他行数据怎么办
标签: c# asp.net gridview webforms