473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Validate control to check 2 entries

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
2 1154
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Abby Lee | last post by:
I must confirm the user enters a value for each fund they need. I do not know how many fund entries there will be...it's expandable to handle each users needs. I must varify each fund they enter is...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I donīt know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
5
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be...
4
by: Wysiwyg | last post by:
I need to validate a form to ensure that all of the fields add up correctly. I can't do this while the user is entering data since validation needs to be done after the entry is completed. What's...
3
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon...
9
by: B-Dog | last post by:
I have a form that has about 10 text boxes on it, they all have to be filled out before submitting is there a quick way to make sure that none are null or do I have to call out each textbox? Say...
11
by: jjbutera | last post by:
I know how to use the ErrorProvider in my winforms..or do I? I validate the values and set the ErrorProvider in the validating event. If not valid, I set e.Cancel = True. I clear the ErrorProvider...
4
by: Angela | last post by:
Hello How would one auto validate using the 'onchange' method a text box for invalid entries? Invalid entries would include: 1. Input string of '....' 2. Input string of 'aaaa' 2. Check...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.