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

Required field validator problem

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
5 2390
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin | last post by:
Dear Group It says in MSDN that a field can be associated with more than one validators but can one validator be associated with more than one field? Or do I need a validator for each field? How...
6
by: Paul | last post by:
I am trying to setup a field validator and tried using the control to validate set to a dropdown list box but did not seem to work. Is there anyway to set this up or do you need to use client side...
4
by: Milan | last post by:
Hi, I am having a problem with displaying a * to a required field. There seems to be a problem with this and the static value does not appear unless you submit the page. I am trying to display...
2
by: pmud | last post by:
Hi, I have an ASP.Net web page . The page was working fine until I added a required field field validator. My page has a link button which takes the user to another page, a submit button which...
3
by: Skeptical | last post by:
Hello, I have a form and two buttons on it. Button1 submits the data to a database and RequiredFieldValidator is used to make sure all the required fields are filled up, the second button has a...
2
by: David Hearn | last post by:
I have some required field validators on a form and would like to know if there is a way to set focus back to the field that is required if the validator is triggered. The problem is that the...
0
by: dinsdale | last post by:
Wow, this is a really embarassing thing to have to ask about... I have an asp.net page with a multiview control in it. We want to enter person info in a semi - wizard style and I wanted to use...
0
by: nimeshdotnet | last post by:
Hi All, I have a textbox whose readonly property is set to true. This textbox is also guarded by a required field validator. What i m doing that I have a calendar control whose on date selection i...
6
by: mathewgk80 | last post by:
Hi all, I have two textboxes, txtName and txtDescription. i added required field validator to both of them. I have a Gridview in the same page. In tht gridview, i have a template field...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.