Author: ma111 | Posted on: 7/28/2008 6:38:03 AM | Views : 295

The code below shows a CustomValidator which calls a javascript function to validate a CheckboxList. (At least one box must be ticked). The Javascript function is called using ClientValidationFunction. This works fine. However my form will have many CheckboxLists and I don't want to have to create a different javascript function for each one.

If I could somehow pass a value from the CustomValidator into the javascript function, I could then have just one javascript function to validate all my checkboxLists. How do I pass the value "CheckBoxList1" (Id of CheckboxList) into the javascript function?
 
<asp:CheckBoxList ID="CheckBoxList1" CellPadding="2" cellspacing="0" RepeatColumns="2" runat="server">
<asp:ListItem Value= Go to the complete details ...