Validate control to check 2 entries

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have a DropDownList control that has a value of 0 for not selected and
a -1 for adding a new company. I want to be able to validate to say that
this selected value is not 0 or -1 but I couldn't find a control validator
that did this. Can someone help? Thanks.
p.s. I am using .Net 2.0 and VS2005.

David
 
David,
Would something like this work for you?
<asp:CompareValidator
ValueToCompare="0"
ControlToValidate="cboList"
ID="dropdownValidator"
ErrorMessage="Please select an option"
runat="server">
</asp:CompareValidator>

If you need to check to entries, just use 2 validators. Or you could create
a Custom Validator.
 
Thanks. Actually, I only needed 1 CompareValidator because a -1 cannot
happen by the time I validate.

David
 
Back
Top