By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,696 Members | 2,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,696 IT Pros & Developers. It's quick & easy.

Validate control to check 2 entries

P: n/a
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
Apr 30 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

--
Page Brooks
www.explosivedog.com
"David C" <dl*****@lifetimeinc.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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

Apr 30 '07 #2

P: n/a
Thanks. Actually, I only needed 1 CompareValidator because a -1 cannot
happen by the time I validate.

David
"Page Brooks" <NO**************@gmail.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
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.

--
Page Brooks
www.explosivedog.com
"David C" <dl*****@lifetimeinc.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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


Apr 30 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.