473,761 Members | 4,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

validator controls

I use a regex validator to check if a textbox is in email format. How do I
make sure zero length input is not accepted? Do I need to use another
requiredfield validator? or is check zero length built-in to the regex
validator?
Jun 4 '06 #1
3 1389
Zero length check is not built into the email validator regular expression.
For this you should use a RequiredFieldVa lidator control.
There's nothing wrong with using more than one validation control to
validate a single input control.

Here's more info:
http://SteveOrr.net/articles/Validation.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Howard" <ho*******@yaho o.com> wrote in message
news:O%******** ********@TK2MSF TNGP02.phx.gbl. ..
I use a regex validator to check if a textbox is in email format. How do I
make sure zero length input is not accepted? Do I need to use another
requiredfiel d validator? or is check zero length built-in to the regex
validator?

Jun 4 '06 #2
Thanks Steve
I have another question about user controls
According to MSDN
If I use a user control like this
<Acme:Login id="MyLogin" UserId="John Doe" runat="server"/>
In the .cs file I put
public string UserId = "";
Then I can reference UserId from my code
my question is if i have a user control like this
<Acme:Login id="MyLogin" runat="server"> something</Acme:Login>

How would I access the text in between the tags?

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:uQ******** ******@TK2MSFTN GP05.phx.gbl...
Zero length check is not built into the email validator regular
expression.
For this you should use a RequiredFieldVa lidator control.
There's nothing wrong with using more than one validation control to
validate a single input control.

Here's more info:
http://SteveOrr.net/articles/Validation.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Howard" <ho*******@yaho o.com> wrote in message
news:O%******** ********@TK2MSF TNGP02.phx.gbl. ..
I use a regex validator to check if a textbox is in email format. How do I
make sure zero length input is not accepted? Do I need to use another
requiredfie ld validator? or is check zero length built-in to the regex
validator?


Jun 4 '06 #3
Many (but not all) controls expose this as their Text property.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Howard" <ho*******@yaho o.com> wrote in message
news:uO******** ******@TK2MSFTN GP05.phx.gbl...
Thanks Steve
I have another question about user controls
According to MSDN
If I use a user control like this
<Acme:Login id="MyLogin" UserId="John Doe" runat="server"/>
In the .cs file I put
public string UserId = "";
Then I can reference UserId from my code
my question is if i have a user control like this
<Acme:Login id="MyLogin" runat="server"> something</Acme:Login>

How would I access the text in between the tags?

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:uQ******** ******@TK2MSFTN GP05.phx.gbl...
Zero length check is not built into the email validator regular
expression.
For this you should use a RequiredFieldVa lidator control.
There's nothing wrong with using more than one validation control to
validate a single input control.

Here's more info:
http://SteveOrr.net/articles/Validation.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Howard" <ho*******@yaho o.com> wrote in message
news:O%******** ********@TK2MSF TNGP02.phx.gbl. ..
I use a regex validator to check if a textbox is in email format. How do
I make sure zero length input is not accepted? Do I need to use another
requiredfiel d validator? or is check zero length built-in to the regex
validator?



Jun 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1352
by: Antonio Maciel | last post by:
Hi. I tried the asp.net newsgroup before but with no success. I have some asp.net validator controls on the pages of a site. In IE the controls work ok but when I run the site on Netscape 7 the scripts for the validator controls are not generated. I tried to get a new <browsercaps> with support for Netscape 7 but could not find anything that works. Have anyone seen this behaviour?
0
2234
by: Tom Pearson | last post by:
I create controls and validators dynamically dependent on data at runtime. I create the control then the relevant validator(s) for it assigning the Control.ID as the control to validate. These controls and validators are then added to a table for display to the user. This code did seem to work originally, but now does not amd I am stumped as to why. There have been some code changes, but not to the methods below and I have pretty much...
2
3921
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
2
3163
by: Dune | last post by:
Hi there, If a control is disabled (enabled = false), will the validator controls associated with it automatically know not to carry out validation? I have a page with a bunch of controls and depending on what is passed in through the querystring, I disable some of those controls in my code-behind. However, my validator controls still seem to be trying to validate the disabled controls. Cheers :)
9
5166
by: Alex Shirley | last post by:
Hi there I’m simply trying to check for a blank or empty value in a textbox on my webform. In this instance I do not want to use a requiredfieldvalidator, I want to use a customvalidator (as I have other code within the customvalidator which works). This won’t work (within servervalidate): If txtBox.Text.ToString = "" Then raise exception…..
3
1673
by: Angelos Karantzalis | last post by:
Hi guys, I've a small problem with validators. I'm building a single .aspx file that handles all my form posts. I need to be using ASP.NET validators ( or subclasses thereof ), so what i do to overcome the fact that i don't really know what sort of input controls I'm working with is this: 1) I've got the form description in xml, so I know all the fields I'm
1
2999
by: Sam Collett | last post by:
Is there a way of having a required field validator check to see if at least one of a set of controls has information in it? I'm sure this can somehow be done using a custom validator, but would like a validator that worked like as a custom tag: <MyValidator:MultipleRequiredFieldValidator ControlsToValidate="TextBox1,TextBox2,TextBox3" ErrorMessage="You did not fill in one of the required fields: TextBox1,TextBox2,TextBox3"...
1
1729
by: Sam | last post by:
Hi all, Why can't i create a validatorControl as a child of the control to validate? It doesn't give any errors, but it just won't work (it's not validating). The reason why i want this is that i'm creating a repository of WebControls extended/inherited with my own code for repetative use. For example, i have a: Class CreationDate inherits TextBox I offcourse want a validator to check is really a date was entered into the textbox.
2
4542
by: Mike Collins | last post by:
I have a form where I create dynamic controls at runtime. With this, I am adding a dynamic required field validator to each control as needed, but the validators are not firing when I click submit. The submit button was placed at design time and its causesvalidation property is set to true. Can someone tell me if something is missing from my code? Thank you. 1. Code to add dynamic control works fine and I get the Id of the textbox...
1
365
by: Gonza | last post by:
Hi group, i'm trying to add a customvalidator control to a custom web control. The problem is i'm getting a "Unable to find control id..." exception. Here is the code: public class CuitTextBox : WebControl { protected override void OnInit(EventArgs e) {
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9957
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...
0
9775
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
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
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
5229
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
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.