Re: Page.Invalid

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The regular expression validator compares the contents of your textbox against a regular expression (regex) If you haven't typed in the regular expression the validator is always going to return true. You need to get a regex for an email address like this one: ^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$



Mark A. Sam wrote:
Hello Ray,

The textbox is a texbox control on a webform, called txtEmail. An email address is what I am testing.

I don't know what you mean by "regex". It seems like the page is always valid. I don't know. I don't know how to test it. All I seem to get is a True result though.

All I am looking to do it to validate data before the button procedure runs, putting the focus back to the offending textox.


Mark



"Ray Booysen" <rj_booysen_NS@xxxxxxxxxx> wrote in message news:%239jOB7aUGHA.776@xxxxxxxxxxxxxxxxxxxxxxx
Some more information is required. What is in the textbox and what is the regex you are using?

Are you saying that the page is always valid?

Regards
Ray

Mark A. Sam wrote:
Hello,

I know this issue has been raised many times in the past, but I couldn't find a solution from reading many posts from a google search, so I am posting it again.

I placed a RegularExpressionvalidator on a webform to test a textbox for a
proper email format. I am trying to test for a failure but can't seem to
get a value. Here is what I tried:

EmailValidator.Validate()
If Not Page.IsValid Then
Beep()
txtEmail.Focus()
End If

ALSO

EmailValidator.Validate()
If Page.IsValid = False Then
Beep()
txtEmail.Focus()
End If

THEN

EmailValidator.Validate()
If Page.IsValid Then
'nothing
Else
Beep()
txtEmail.Focus()
End If

None of these three methods works, but

"If Page.IsValid Then..." form

Is recognized.



Thanks for any help

God Bless,




.



Relevant Pages

  • Re: Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine
    ... I tested this expression in the ASP validator and it worked - just as it ... > bit of documentation I read that in. ... >>I see signs that the ASP.NET regular expression validator has a different ... >> Please note that this is not a request for help in forming a regex. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?
    ... bit of documentation I read that in. ... >I see signs that the ASP.NET regular expression validator has a different ... > expressions for use in a ASP.NET validator. ... > Please note that this is not a request for help in forming a regex. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Regexp Validation
    ... Use a RegEx like this ... First of all '^' matches the beginning of the string. ... > I am using the regular expression validator... ...
    (microsoft.public.dotnet.framework)
  • How to write Regular Expression
    ... I want to write Regular Expression for validator, ... the textbox, in which must be text from 0 to 10 length and any character ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: RegularExpressionValidator question
    ... Trying to setup RegularExpressionValidator to validate a textbox. ... The validator uses client-side javascript by default, and the js-syntax for regexes is a subset of the syntax in .Net. ... So be careful when you use some regex that works in .Net in a validator. ...
    (microsoft.public.dotnet.framework.aspnet)