Monday, March 26, 2012

Validating dropdowns

Does anyone know how i can validate a drop down. My initial value in the list is "--Choose--".
I want my required validator field to check that the selected value does NOT equal the initial value.
Please Heeeellllpppp!Add "--Choose--" as follows

cbo.Items.Add(New ListItem("--Choose--", ""))

where cbo is name of the Combo.

When required field vaildator is set for this combo, it will return false.

In this case, required field vaildator will check for Value in the selected option, but the value is set as "".
you can set the

InitialValue
property of the requiredfieldvalidator to "--Choose--".
hth

No comments:

Post a Comment