我想在dataview中添加checkbox控件,实现全选,可是老提示错误,高手指教
protected void chSelect_CheckedChanged(object sender, EventArgs e){
CheckBox cbAll = (CheckBox)sender;
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox aa = (CheckBox)gvr.FindControl("chSelect");
aa.Checked = cbAll.Checked;
}
}
这个什么地方错了 还有
protected void chSelect_CheckedChanged(object sender, EventArgs e)
{
CheckBox cbAll = (CheckBox)sender;
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox aa = (CheckBox)gvr.FindControl("chSelect");
//aa.Checked = cbAll.Checked;
aa.Checked = true;
}
} 这样写可不可以
[ 本帖最后由 loveaspnet 于 2010-4-21 20:06 编辑 ]