Validating dropdownlist asp net

thx By default, the first item in a dropdownlist is always selected. 2 solutions: 1) Use a List Box instead 2) Add a dummy first item, and force the user to select another item with a custom validator or a range validator (when your values are numbers) -- Jos Microsoft's Required Field Validator is designed to detect that a listbox has no selection. Can a requiredfieldvalidator be used for a dropdown list, and how would you use it? I see someone else joined my question and he got his answers, my question in still there. I have a drop down list which is not visible at first. Add(new List Item("Miss Player", "MP")); ddl_season. Net Developer Vadodara - Gujarat Please remember to click “Mark as Answer” on the post that helps you. Add(new List Item("--Select one--", "")); ddl_season. I have a requiredfieldvalidator for my dropdownlist. User choses some options(somewhere else) and according to that I fill the dropdown list and make it visible. Add(new List Item("John Player", "JP")); ddl_season. This can be beneficial to other community members reading the thread.

validating dropdownlist asp net-78validating dropdownlist asp net-51validating dropdownlist asp net-70

Assign it the same value you have in the List Item.

Validation is one of the greatest security features to prevent your website against spam. One is from which means we are calling a Validate Drop Down List() function on client-click event of btn Save and evaluate image type is selected or not from the dropdownlist to validate the dropdown or dropdownlist in

edit: here is what i exaclty wants to happen: how to validate a dropdownlist and i have done this zillion times but what i am doing wrong here? i am trying to validate the dropdownlist if the user have not select any help?

Maybe when dropdownlist is not visible it's a problem, but even when dropdown list is visible, the requiredfieldvalidator seems to just ignore the fact that it's empty and let's the user press buttons.

I have requiredfieldvalidators for my textboxes on the same page and they work perfectly.

Leave a Reply