Re: Page.Invalid
- From: Ray Booysen <rj_booysen_NS@xxxxxxxxxx>
- Date: Tue, 28 Mar 2006 09:56:22 +0100
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@xxxxxxxxxxxxxxxxxxxxxxxSome 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,
- References:
- Page.Invalid
- From: Mark A. Sam
- Re: Page.Invalid
- From: Ray Booysen
- Re: Page.Invalid
- From: Mark A. Sam
- Page.Invalid
- Prev by Date: Re: AJAX.net vs. Atlas
- Next by Date: Re: How to convert VB.Net code to ASP.Net ?
- Previous by thread: Re: Page.Invalid
- Next by thread: Re: Page.Invalid
- Index(es):
Relevant Pages
|