Validate DropDownlList Control unsing RequiredField Validator in ASP.Net

In this asp.net post we will learn how to validate dropdownlist control using requiredfield validator control in asp.net.

For understand validate dropdownllist control in asp.net using required field control create a asp.net web for with one dropdownlist control, button control along with requiredfield control.

take dropdownlist control and add some items in dropdownlist, In dropdownlist control we must select item from second to last, means requiredfiled validator control show the error message, if we select the first item from dropdownlist.

Here is the design code for dropdownlist example:

- design code for requiredfiled validator control:

here, we set two property of requiredfield validator
- ControlToValidator=”DropDownList1″
-InitialValue=”SELECT” <– Fist value of dropdownlist control

Here, is the output of dropdownlist control validate asp.net example:

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Validate Dropdownlist control using RequiredField Validator control in ASP.Net

Leave a Reply

Your email address will not be published. Required fields are marked *

8 + 6 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">