NET provides a variety of validation Web controls that can be used to validate a user's form field inputs. NET 2.0 for the validation control changes from ASP. NET version 2.0.) Unfortunately, the validation Web controls do not work with the Check Box or Check Box List Web controls.
for general information on the validation Web controls and Dissecting Validation Controls in ASP.
Let’s take a look at how to do that with a text field that is only supposed to have a value of either ‘AAAA’ or ‘BBBB’ (yes, I know that this does not make much sense in a real PDF form).
So, if the user enters ‘01234’ we should see an error message that would instruct the user about what type of data is valid for this field.
To start, we create a text field and bring up the properties dialog for the field.
Why would you want to have a required checkbox, i.e. Well, a typical example would be that you have some sort of terms associated with submitting a form that the user has to agree to. It is quite easy however to create your own custom validation attribute that you could decorate your boolean property with.To provide such validation, we have three choices: In this article we'll implement the third option, creating two custom server controls, Check Box Validator and Check Box List Validator. The server controls provided in this article were designed using Visual Studio 2005 and the . NET 1.x, check out Creating a Validation Control for Check Box Lists.The download at the end of this article includes both the entire source code and a compiled assembly that you can drop into your ASP. NET Framework 2.0's base class libraries; consequently, they will only work in ASP. Alternatively, you may adapt the code presented here to work in ASP. The server controls examined in this article were designed using Visual Studio 2005 and the . NET 1.x, check out Creating a Validation Control for Check Box Lists.Don’t leave it to the auto-generated default messages.Explain to your user what is wrong and suggest solutions.