我在asp.net中使用gridview,左栏是复选框。如何在提交按钮时告诉哪些行有“选中”复选框?
答案 0 :(得分:1)
CheckBox chkBx = new CheckBox();
for (int i = 0; i < grdView.Rows.Count; ++i)
{
chkBx = (CheckBox)grdView.Rows[i].FindControl("yourCheckBoxIDInHTMLView");
if (chkBx.Checked == true)
{
// Do some work here
}
}
答案 1 :(得分:0)