473,386 Members | 1,823 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,386 software developers and data experts.

Page.Invalid

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,


Mar 27 '06 #1
5 2311
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,

Mar 27 '06 #2
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***********@rjb.za.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
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,


Mar 27 '06 #3

"Ray Booysen" <rj***********@rjb.za.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
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?


No. I tested the value:

EmailValidator.Validate()
MsgBox(Page.IsValid, MsgBoxStyle.Information, "Page.Invalid")

When a correct email address is entered, the msgbox returns, "True"
otherwise it doesn't come up.

The Validation control responds with a message in either case, but I need to
trap the result.


Mar 27 '06 #4
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***********@rjb.za.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
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,

Mar 28 '06 #5
For anyone whop runs into this same issue. The procedure is being run from
a button, which has a default value of True for the CausesValidation
property. Setting the property to False resolved it.
Mar 28 '06 #6

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

Similar topics

16
by: Dave Smithz | last post by:
Hi, In summary: I want to a form to submit information via a HTTP POST, however, when using Internet Explorer I want to be able to use the back button and all the information retained....
37
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
3
by: Gvnn | last post by:
Hi, I've a little problem, i've an asp.net page, with a runat server form, like this: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb" Inherits="indexGstPro"%> <HTML>...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
2
by: Brad | last post by:
I have an intranet app that has just started sporadically getting the following error "The viewstate is invalid for this page and might be corrupted." By sproadic I mean 3-4 times during the past...
7
by: Jason | last post by:
Can anybody help on the following error : The viewstate is invalid for this page and might be corrupted. Description: An unhandled exception occurred during the execution of the current web...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: ...
0
by: mwmorrison93 | last post by:
Hello, I'm at my wit's end regarding the "The state information is invalid for this page and might be corrupted" error and I'm hoping someone can provide some assistance. I working with C#/ASP.NET...
7
by: Andy B | last post by:
I have an instance of an object that needs to be accessed by all members of a page like page_load, button_click events and so on. Where in the codebehind would I put the creation of the object...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.