By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Required field validator problem

P: n/a
Do
Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But
the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

For server-side code, you need to call Page.Validate() before you test
Page.IsValid.

For more information, see ASP.NET Validation in Depth
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspplusvalid.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Do" <do*************@hotmail.com>
Subject: Required field validator problem
Date: Mon, 20 Oct 2003 22:24:20 -0700
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-120-230-110.dsl.lsan03.pacbell.net 66.120.230.110 Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185460
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But
the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If


Nov 17 '05 #2

P: n/a
Hi,

For server-side code, you need to call Page.Validate() before you test
Page.IsValid.

For more information, see ASP.NET Validation in Depth
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspplusvalid.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Do" <do*************@hotmail.com>
Subject: Required field validator problem
Date: Mon, 20 Oct 2003 22:24:20 -0700
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-120-230-110.dsl.lsan03.pacbell.net 66.120.230.110 Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185460
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But
the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If


Nov 17 '05 #3

P: n/a
Hi:

So what's the difference between Page.IsValid and Page.Validate and the
different
scenarios for their use?

So if I only use Page.IsValid, this will only do client-side validation?
If Page.IsValid does not return true, doesn't the nested code not process?
Mine seems like it processes.
Do
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:FH**************@cpmsftngxa06.phx.gbl...
Hi,

For server-side code, you need to call Page.Validate() before you test
Page.IsValid.

For more information, see ASP.NET Validation in Depth
http://msdn.microsoft.com/library/de...us/dnaspp/html /aspplusvalid.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "Do" <do*************@hotmail.com>
Subject: Required field validator problem
Date: Mon, 20 Oct 2003 22:24:20 -0700
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-120-230-110.dsl.lsan03.pacbell.net

66.120.230.110
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185460 X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If

Nov 17 '05 #4

P: n/a
Hi:

So what's the difference between Page.IsValid and Page.Validate and the
different
scenarios for their use?

So if I only use Page.IsValid, this will only do client-side validation?
If Page.IsValid does not return true, doesn't the nested code not process?
Mine seems like it processes.
Do
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:FH**************@cpmsftngxa06.phx.gbl...
Hi,

For server-side code, you need to call Page.Validate() before you test
Page.IsValid.

For more information, see ASP.NET Validation in Depth
http://msdn.microsoft.com/library/de...us/dnaspp/html /aspplusvalid.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "Do" <do*************@hotmail.com>
Subject: Required field validator problem
Date: Mon, 20 Oct 2003 22:24:20 -0700
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-120-230-110.dsl.lsan03.pacbell.net

66.120.230.110
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185460 X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If

Nov 17 '05 #5

P: n/a
Hi,

Page.Validate calls the method the runs your validation code. Page.IsValid
tests the results of the validation. I suspect that you are submitting the
form with a control that does not cause validation. In this case, you must
call Page.Validate explicitly in your code. Then you can test the value of
Page.IsValid.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
Reply-To: <do*************@hotmail.com>
From: <do*************@hotmail.com>
References: <uy**************@tk2msftngp13.phx.gbl> <FH**************@cpmsftngxa06.phx.gbl> Subject: Re: Required field validator problem
Date: Tue, 21 Oct 2003 17:23:20 -0700
Lines: 119
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#q**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-121-42-242.dsl.lsan03.pacbell.net 66.121.42.242
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185660
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi:

So what's the difference between Page.IsValid and Page.Validate and the
different
scenarios for their use?

So if I only use Page.IsValid, this will only do client-side validation?
If Page.IsValid does not return true, doesn't the nested code not process?
Mine seems like it processes.
Do
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:FH**************@cpmsftngxa06.phx.gbl...
Hi,

For server-side code, you need to call Page.Validate() before you test
Page.IsValid.

For more information, see ASP.NET Validation in Depth

http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspplusvalid.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
From: "Do" <do*************@hotmail.com>
Subject: Required field validator problem
Date: Mon, 20 Oct 2003 22:24:20 -0700
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: adsl-66-120-230-110.dsl.lsan03.pacbell.net

66.120.230.110
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:185460 X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Has anybody run into problems with Page.IsValid?
My errors show up when the fields aren't filled correctly, but my
processing continues even if the page is invalid.

I leave name and description blank and I do get the error messages. But the code still continues to run the addfolder method from my class.

Is there something wrong with this?

Here's the code:

Dim strName As String

Dim strDescription As String

Dim intParent As Integer

strName = txtName.Text

strDescription = txtDescription.Text

intParent = lstParents.SelectedValue

Response.Write(strName)

Response.Write(strDescription)

Response.Write(intParent)

If Page.IsValid Then

Try

Dim objFolder As New folder

If CBool(objFolder.addfolder(strName, strDescription, intParent)) Then

Response.Write("Inserted new folder")

Else

Response.Write("Problem with folder insertion")

End If

objFolder = Nothing

Catch ex As Exception

Response.Write(ex.Message)

End Try

End If



Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.