Search This Blog

Monday, November 1, 2010

Validation- CustomValidators:CheckboxList

< script type="text/javascript">

//– To Validate CheckBoxList
function ChequarSelecciondeTipoModificacion(source, args)
{
var chkListaTipoModificaciones= document.getElementById ('<%= CheckBoxList1.ClientID %>');
var chkLista= chkListaTipoModificaciones.getElementsByTagName("input");
for(var i=0;i {
if(chkLista[i].checked)
{
args.IsValid = true;
return;
}
}
args.IsValid = false;
}
< /script>
< asp:CheckBoxList ID="CheckBoxList1″ runat="server">
< /asp:CheckBoxList>
< asp:CustomValidator ID="CustomValidator1″ runat="server" ErrorMessage=”" ClientValidationFunction=”ChequarSelecciondeTipoModificacion”>< /asp:CustomValidator>

No comments:

Post a Comment