Validating dropdownlist asp net
Validating Drop Down List with Required Field Validator We use Required Field validator to validate an input control to be mandatory.
When we use dropdownlist control it is not enough if we set the Control To Validate property to the dropdown id. Net validation controls will fire for any postback caused by any of the controls on the page.
Using Image as a Validation Message in Validation Control We can also set some images as a validation messages when we use validator control.
For example, we can show mandatory image as a validation message if a field is mandatory with Required Field validator control.
For example, the requirement may be placing all the validation messages on top or bottom of the pages.
Similarly, to call other validator controls refer the below table. Most of the time, we will need to do more than what these validator controls offers us and this article will help you in achieving some of those.
This article will help us to use the validation control to the maximum extent to serve our project needs.
Validator control will fire on blur By default, when we use validator control it will fire the validations on blur of the control.
Also, there are some cases where we need to validate on users input based on some criteria or business rule that is calculated on server side due to the dependency on database etc.
It is always good to repeat some of the business critical validations on server side as a precaution.