I am using the code below to force customers to select item from a Grid CheckBox
function GetCheckedItemCountbtnClick() {
var checkedcount = 0;
var grid = $find("<%=gvSummary.ClientID %>");
for (var i = 0; i <
grid.get_masterTableView
().get_dataItems().length; i++) {
var
objchkbox
=
grid
.get_masterTableView().get_dataItems()[i].findElement("CheckBoxStatus");
if (objchkbox.checked) {
checkedcount++;
}
//}
if (checkedcount > 8) {
objchkbox.checked = false;
alert("Please select only 8 item");
return false;
}
}
if (checkedcount == 0) {
alert("Please Check at least one CheckBox");
return false;
}
}
I have a Button I want to disable when the 'checkedcount ==0' unless an item is checked
<
asp:Button
ID
=
"btnPrint"
runat
=
"server"
Font-Size
=
"X-Small"
OnClick
=
"btnPrint_Click"
Text
=
"Print"
ToolTip
=
"Create a report..."
/>
Nothing seems to work for me. Any idea will be appreciated.