Click here to Skip to main content
15,908,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

How to add the Require field validation in dropDownCheckBoxes ...?

This is my code

<asp:dropDownCheckBoxes ID="ddllanguage" runat="server" xmlns:asp="#unknown"  onchange="onSelectionChange()"
                AddJQueryReference="True" UseButtons="false" UseSelectAllNode="false" ClientIDMode="Static">
                <Style SelectBoxWidth="200" dropDownBoxBoxWidth="200" dropDownBoxBoxHeight="130" />
                <Texts SelectBoxCaption="-Select-" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"  ControlToValidate="ddllanguage"
                          ErrorMessage="*" ToolTip="Language is required"
                         ValidationGroup="Veterinary" InitialValue="-Select-"

When i run the application i am getting this error "Control 'ddllanguage' referenced by the ControlToValidate property of 'RequiredFieldValidator2' cannot be validated."

anybody give me any suggestion how to add the validation....

Updated 16-Jun-14 22:59pm
Bh@gyesh 17-Jun-14 2:48am    
Change InitialValue property with your value field i.e. "0" or "-1" whatever your value for "-Select-".
Sunasara Imdadhusen 17-Jun-14 4:55am    
i think there is minor mistake. you have not wrapped control to validate in "". It should be
Gujula Ravindra Reddy 17-Jun-14 5:00am    
Thanks for giving the reply Sorry it's not working....
Bh@gyesh 17-Jun-14 5:08am
Gujula Ravindra Reddy 17-Jun-14 5:20am    
Sorry my question is dropdowncheckbox contorl not dropdownlist ..dropdowncheckbox are not supported requirefield validator...

1 solution

Share this answer
Gujula Ravindra Reddy 17-Jun-14 5:34am    
thanks for giving the reply .its working but my requirement is after loading the page click on submit button that dropcheckbox showing error message like "please select language" .please give me a reply...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900