473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1173
David,
Would something like this work for you?
<asp:CompareVal idator
ValueToCompare= "0"
ControlToValida te="cboList"
ID="dropdownVal idator"
ErrorMessage="P lease select an option"
runat="server">
</asp:CompareVali dator>

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*****@lifeti meinc.comwrote in message
news:%2******** ********@TK2MSF TNGP04.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 CompareValidato r because a -1 cannot
happen by the time I validate.

David
"Page Brooks" <NO************ **@gmail.comwro te in message
news:uI******** ******@TK2MSFTN GP03.phx.gbl...
David,
Would something like this work for you?
<asp:CompareVal idator
ValueToCompare= "0"
ControlToValida te="cboList"
ID="dropdownVal idator"
ErrorMessage="P lease select an option"
runat="server">
</asp:CompareVali dator>

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*****@lifeti meinc.comwrote in message
news:%2******** ********@TK2MSF TNGP04.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
2171
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 six digits long. I have no problems with the Is_In_Format function (I found it on the web and am using it for other things). My problem is with my validate function which I've cut down (oh it doesn't work but you can see the direction I am...
6
2163
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. could you please have a look at the following script: ------------------------------------------------------------
6
3419
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 sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
5
2530
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 invoked. I am probably wrong about that. If I am suppose to use this function, the edits seemed to be invoked even when you have pressed the cancel and the "CausesValidation" is set to false. Is there a way to get around this (might just be an...
4
4294
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 the "best" way to validate prior to submitting? I could add an onsubmit attribute to the form which executes the validation in Javascript. That way the response doesn't need to be sent before validation takes place. Is this pretty much the way...
3
5968
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 validators, so I have a button on the form and the "causes validation" property is set to true. I have overridden the "Validate()" like so
9
6702
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 something like textbox1 through textbox10? Thanks
11
11770
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 in the validated event. Is there a way to know if all validated controls pass validation when the user clicks an OK button? In ASP.Net there's the Page.IsValid method. Is there something similar in winforms, or do I still have to write an...
4
6357
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 to see if all entries are uppercase
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10578
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.