16 September, 2009

RequiredFiledValidator For CheckBoxList


RequiredFiledValidator For CheckBoxList

function checkTemp(sender,args)

{

     for(var i=0;i<=document.getElementById("CheckBoxList1").firstChild.children.length-1;i++)

     {

          if(document.getElementById("CheckBoxList1").firstChild.children(i).cells(0).children(0).checked)=='true'

          args.IsValid=true

          return                    

     }

     args.IsValid=false

}

<asp:CustomValidator id="valcheckBoxTemp" runat="server" ClientValidationFunction="checkTemp"

ErrorMessage="This is required control "></asp:CustomValidator>  

No comments: