Validating dropdownlist asp net

Rated 4.31/5 based on 915 customer reviews

Hello Parul, If this is the very same implementation that you are using at your end, the Rad Drop Down List would be populated, with setting its first item as selected.Other possible implementation would be to set the Default Message property of the Rad Drop Down List.So the basic Drop Down List looks like this: One quick note, which I had discovered along the way.The Append Data Bound Items property will take any statically created List Items you have in the control and bind them to the Drop Down List before your databound elements are added.In this article you will see how to put validation in dropdownlist by javascript, suppose first item value of dropdownlist is 0 and text is "-Select-" just like given below and we have to validate that at least one item is selected excluding default i.e "-Select-".Just copy and paste javascript code given below and pass the parameter dropdownlist id, you can customize alert validation error message according to requirement.I have the following code for my Rad Drop Down List ; The Required Field Validator is not being fired. If you want to push the user to select an item different from the first one, you could set the Initial Value property of the Required Field Validator and set first item's Text to the Initial Value property, like demonstrated in this video. In this case the validation would pass, because a Patient ID is actually selected.

I could always specify a default value when loading the page, but more often than not it adds to the confusion for my end users.

In this scenario if you add a Required Field Validator, the validator can not validate the Drop Down List.

To do that you have to mention Required Field Validator Initial Value property =”0″.

When we bind data into a Drop Down List Control we found that the first List Item getting selected by default.

If you want to force to select an Item of a Drop Down List rather than default selection you have to add a List Item like “–Please Select–” as an Item.

Leave a Reply