Validation Check Boxes Using JavaScript
if (aspnetForm.ctl00$PlaceHolderMain$ddlKaizenCategory != "--Select Category--") {
var chkListModules = document.getElementById('<%= cblBenefitCategory.ClientID %>');
////debugger;
var chkListinputs = chkListModules.getElementsByTagName("input");
for (var i = 0; i < chkListinputs.length; i++) {
if (chkListinputs[i].checked) {
args.IsValid = true;
return;
}
}
args.IsValid = false;
}
}
Simple Another Way:
protected void btn_click(object sender,EventArgs e) { foreach(GridViewRow row in Gv.Rows) { if(((CheckBox)row.FindControl("chk")).Checked==true) { //do stuff on here } } }
Comments