Avatar of Ollie90
Flag for United States of America asked on

ControlToValidate in group

i have this validation and it works fine for dropdownlist16. but now i want to use this validator on several dropdownlists without creating a validator for each dropdownlist. In the properties of the dropdownlists i have set the validationgroup to "FieldRequired' .. but other dropdownlists beside dropdownlist 16 are not reacting .. what do i need to change?
<asp:RequiredFieldValidator ID="RequiredFieldValidatorFieldRequired" runat="server" ControlToValidate="DropDownList16"

ErrorMessage="This field is required!" ValidationGroup="FieldRequired"></asp:RequiredFieldValidator>

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon
Paul Jackson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

ok .. now i understand the word "group"  :)

i think it's than more efficient to make the validation in vb.net (just checking all the dropdownlists) instead of using the validation control?
Paul Jackson

Well the benefit of using validator controls is that it generates javascript client-side validation that prevents a need to post-back to the server.

but i can do this in one swing .. the validation can be done for all dropdownlists when users hits a button. I dont need a validation when a certain dropdownlist is empty for example
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Paul Jackson

Yes that's true if you can also write an javascript function to do some client-side validation assigned to the onclientclick event of the button to stop unnecessary postbacks to the server.