Use the Custom Validator control to provide a user-defined validation function for an input control.
The Custom Validator control is a separate control from the input control it validates, which allows you to control where the validation message is displayed.
Suppose in your application you are using a Drop Down List in a Form and depending upon the item selection you are showing/hiding some views inside a Multiview and you want that the user must select one of the item from the Drop Down List before submitting a Form.
So you can write code like the following to validate the Drop Down : This code will work fine but it has an issue.
In Asp.net, sometimes we need to validate List Box and Drop Down List using Required field validator.
It is tricky and avoids the use of Java Script function to validate List Box and Drop Down List. For validating Drop Down List, make sure you have "--Select--" option value 0 other wise validation on it will not work.
Please let me know how to validate the fist item of dropdown list ISSUE 2 I am getting dual message, one under the dropdown list [which is showing error "Carson63000" in red] and one as a pop up [validator call out]. I want that only validator callout should display the message.
means: check the value of the dropdown, and validate that it is equal to "-- Please Select --"; if not, display the error.
so web developers need to ensure that users select an item from dropdownlist control other than the first item.
we can validate a dropdownlist server control using Required Field Validator control.
I have a drop down list on a page, by default the option that is displayed is 'Please Select One'.