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

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

This is my code

XML
<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:dropDownCheckBoxes>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"  ControlToValidate="ddllanguage"
                          ErrorMessage="*" ToolTip="Language is required"
                         ValidationGroup="Veterinary" InitialValue="-Select-"
                        ></asp:RequiredFieldValidator>


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....

Regrads
Ravinder
Posted
Updated 16-Jun-14 22:59pm
v2
Comments
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
ControlToValidate="ddllanguage"
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    
http://forums.asp.net/t/1123576.aspx?how+to+set+required+field+validator+with+DropDownList
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
 
Comments
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