如何用数组获取gridview中选中的checkbox的值
1个回答
展开全部
用循环查看每一行的CheckBox就否选备猜中,选中则数组中存true,没有则知滚租存false
string[] strArr=new string[this.gridview1.Rows.Count];
pulice static int i=0;
foreach(GridViewRow row in this.gridview1.Rows)
{
Control ctrl = row.FindControl("CheckBox"搭兆);
if ((ctrl as CheckBox).Checked)
{
strArr[i]=true;
i++;
}
else
{
strArr[i]=false;
i++;
}
}
string[] strArr=new string[this.gridview1.Rows.Count];
pulice static int i=0;
foreach(GridViewRow row in this.gridview1.Rows)
{
Control ctrl = row.FindControl("CheckBox"搭兆);
if ((ctrl as CheckBox).Checked)
{
strArr[i]=true;
i++;
}
else
{
strArr[i]=false;
i++;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询