Ian Haynes, ASP.Net in Expression Web MVP, has a top tip about validation controls.
Validation on a drop down list
At first glance it looks as though there is no way of adding the normal validation to a drop down list to indicate that a values needs to be selected. In fact it's very simple.
Add a list item 'Select', set it as 'selected' and put it's value = ""
Then add a RequiredFieldValidator to the drop list control. As no value is given for the 'Select' option, the validator triggers and your error message is shown.
Validation on a drop down list
At first glance it looks as though there is no way of adding the normal validation to a drop down list to indicate that a values needs to be selected. In fact it's very simple.
Add a list item 'Select', set it as 'selected' and put it's value = ""
Then add a RequiredFieldValidator to the drop list control. As no value is given for the 'Select' option, the validator triggers and your error message is shown.
Comments