ForEach(GridViewRow row in MyGridView.Rows)
{
if (row.RowType == DataControlRowType.DataRow) //avoid header/footer rows.
{
var myCheckBox = (CheckBox)row.FindControl("chkSelect");
//myCheckBox.Checked tells you if it's checked or not, yay!
var myPrimaryKey = (GuidOrIntOrSomething)MyGridView.DataKeys[row.RowIndex].Value;
//now you have your Key and the checkbox for whether the user has checked it
//and you can do your update/insert/delete/whatever against the DB.
}
}
, и вы действительно должны иметь дело с мучительным javascript, необходимым для того, чтобы поставить галочку напротив всех пунктов, используя галочку «Все». Пользователям очень нелогично и неприятно получать обратную передачу, когда они щелкают по ней.