//Gridview
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox runat="server" ID="Chk_allCh" />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox runat="server" ID="Chk_all" onclick="checkAllRow(this);" />
</HeaderTemplate>
</asp:TemplateField>
//Script
function
checkvalidateSelect() {
var
gridView =
document.getElementById('<%=GridViewID.ClientID %>');
var
isValid = false;
for
(var i = 1; i < gridView.rows.length; i++) {
var inputs = gridView.rows[i].getElementsByTagName('input');
if (inputs != null) {
if (inputs[0].type == "checkbox")
{
if (inputs[0].checked) {
isValid = true;
break;
}
}
}
}
if
(!isValid) {
alert('Please select at least one');
return false;
}
else
{ return
true; }
}
No comments:
Post a Comment