Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RequiredFieldValidator
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
RequiredFieldValidator
Environment versions
Environment:
C# 3.0
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01462650
Message ID:
01462650
Views:
90
I've got a Project in my C# class in which I am using ASP.NET to lay out a Store web page. This is really simple stuff, nothing too complex yet.

There are 3 CheckBox controls which represent flags from the USA, France and Texas, which are for sale (This isn't for real). To the right of each CheckBox control, there is a Quantity TextBox control.

Below all of this are TextBox controls to gather in the person's name, address, etc., then a Submit button at the bottom of all of this.

I did not put any validator controls on the CheckBox controls, but did on the Quantity TextBox controls for Range Validation, limiting the buyer to between 0 and 10 flags in each purchase. I then added RequiredFieldValidator controls to the name and address controls. I've set everything. I lastly added a ValidationSummary control after all the other TextBox and CheckBox controls.

So, here's my question:

If the buyer Checks one Flag and does NOT enter a Quantity in the Quantity TextBoxControl for that Flag, and you hit the Submit button, how do you inform the user that he has left out a quantity? How do you make the RequriedFieldValidator capture the fact that something should have been entered, if the buyer selected a Flag?

I know that you can use a RequiredFIeldValidator to make sure something is entered, but what if the user didn't select that particular Flag? Do you have to set up an if condition in the code behind page to capture the CheckBox having been set to TRUE, and then check its Quantity TextBox control? In other words, how flexible are these validation controls?

Maybe this isn't as easy as I had thought.
Next
Reply
Map
View

Click here to load this message in the networking platform