Validation fields asp.net

Hi All,

I have 4 textboxes (A, B, C and D) and a radiobuttonlist called R

Since all fields are required, I need to place a Validator, but I dont want to put one per field. Is it possible to group all validations into one validation that say "All Fields are Required" in case an of the controls is empty?

Thanks!
pvg1975Asked:
Who is Participating?
 
rajvjaCommented:
You can use validationgroup.

Try this link

http://forums.asp.net/t/1146421.aspx/1

0
 
pvg1975Author Commented:
Hi, thanks, I saw the example, but I dont see how can I apply it for my code.
0
 
ddayx10Commented:
I know you don't want to put 1 validator per control but that would be the easiest way to accomplish your stated goal.

1 validator per control then put validationgroup on each control and validator as well as whatever controls cause the postback.

Otherwise you need to use customvalidation for which there is a customvalidator control (or you can just write it yourself), but you need to understand JS if you want it client-side then write the server-side if you want it to be comprehensive validation.

As I said, easiest for you is to follow rajvja's advice.

Here's a different tutorial:

http://www.howtoasp.net/asp-net-4-0-tutorials/how-to-use-validation-groups-in-asp-net-4-0/

If you want more precise help it would be good to post a simplified version of your code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.