Microsoft's RequiredFieldValidator is designed to detect that a listbox has
no selection. If you actually want to make the first item of the list be
selected and say "Make a selection", you can validate that with these steps:
1. Set the ListItem.Value to "noselection"
2. Use a RequiredFieldValidator
3. Set RequiredFieldValidator.InitialValue = "noselection"
--- Peter Blum
www.PeterBlum.com
Email:
PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Jos" <jo***************@fastmail.fm> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Cortvriend Andy wrote: hi
i'm filling an dropdownlist with data from sql server
now i want to validate if a selection have been made
the problem is that the validator never shows up
i think he always says that something is selected
Anyone who can help me ???
thx
By default, the first item in a dropdownlist is always
selected.
2 solutions:
1) Use a ListBox 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