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

Page showing as not valid

I have a page that is showing as:

Page.IsValid = False

on postback when my submit button is pressed but none of my Validators have
fired so there is no error message.

How do I find out what is making the Page invalid?

Thanks,

Tom
Feb 14 '07 #1
7 1785
Well, here are some questions/tests that might help you and some of us in
the newsgroups answer your question:

1. How do you know that none of the Validators fired?

2. What is the value for the CausesValidation property of any Buttons,
TextBoxes, DropDownLists, or other controls that might have that property on
your page?

It may also help us answer your question if we could see your code so that
we know exactly what is happening on your page, so you may want to post it.
Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I have a page that is showing as:

Page.IsValid = False

on postback when my submit button is pressed but none of my Validators
have fired so there is no error message.

How do I find out what is making the Page invalid?

Thanks,

Tom

Feb 15 '07 #2
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OE**************@TK2MSFTNGP05.phx.gbl...
Well, here are some questions/tests that might help you and some of us in
the newsgroups answer your question:

1. How do you know that none of the Validators fired?
Because I have no error messages. I have only 2 Validators

<td ><asp:TextBox ID="RequestedStartDate" Columns="12"
runat="server"/>
(Applicant will have the option to request an alternative date)
<asp:RequiredFieldValidator runat="server"
ControlToValidate="RequestedStartDate"
Display="Dynamic"
Type="Date" text="<br>Start Date Required"/>
<asp:RegularExpressionValidator
ControlToValidate="RequestedStartDate"
ValidationExpression="^(([1-9])|(0[1-9])|(1[0-2]))\/(([1-9])|(0[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))\/((\d{2})|(\d{4}))$"
Display="Dynamic"
Text="<br>From Date Invalid or in Wrong Format(MM/DD/YY)"
runat="server"/>
>
2. What is the value for the CausesValidation property of any Buttons,
TextBoxes, DropDownLists, or other controls that might have that property
on your page?
I don't have anything set for the CausesValidation of any objects. I have 2
textboxes and about 10 dropdowns.
>
It may also help us answer your question if we could see your code so that
we know exactly what is happening on your page, so you may want to post
it.
It would be a little hard to post as it is a large page which is a One page
(not code-behind) style.

The test is:

trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid )
If not Page.IsValid then
Exit Sub
End if

In the above code Page.IsValid is set to false.

Thanks,

Tom
Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>I have a page that is showing as:

Page.IsValid = False

on postback when my submit button is pressed but none of my Validators
have fired so there is no error message.

How do I find out what is making the Page invalid?

Thanks,

Tom


Feb 22 '07 #3
I think I found the problem but not why. It has to do with the fact that
HTML comments don't seem to work with asp.net.
I have the following page:
************************************************** ******
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" Inherits="MyFunctions.Page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<Script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim item as ListItem
Dim oLabel as Label
if not IsPostBack then
ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")
end if
end sub

Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs)
Dim pageError as Boolean = false
trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid & "
PageError = " & pageError)
If not Page.IsValid then
Exit Sub
End if
End Sub
</script>
<html>
<head>
<title>:: Staffing Workshop ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body id="myBody" runat="server">
<form runat="server">
<asp:TextBox ID="RequestedStartDate" Columns="12" runat="server"/>
<!-- <asp:CompareValidator runat="server" ID="ValidateDate"
ControlToValidate="RequestedStartDate"
Operator="GreaterThan"
Display="Dynamic"
Type="Date" text="<br>Invalid Start Date"/>
-->
<asp:ImageButton ImageUrl="../../buttons/submit_0.gif"
OnClick="SubmitNewHire_Click" runat="server"/>
</form>
</body>
</html>
************************************************** ***********

I should get an error here.

I have the Validator commented out but the line:

ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")

Still seems to work. I should get an error that says that there is no such
object ValidateDate (as it is commented out). If I delete the Validator - I
get the error.

If I take out the ValidateDate.ValueToCompare line, I get an error saying
that '' is not a valid date. Why would I get that error if this Validator
is commented out? I get this error as I am entering the page.

This was why I was getting the error.

I was putting in yesterdays date (which the validator says I can't do). So
the page is showing as not valid. But since the Validator is commented
out - the error message doesn't show (which it does if I don't comment it
out).

What gives?

Thanks,

Tom
Feb 22 '07 #4
When commenting out an ASP.NET tag, you need to use <%-- --%rather than
<!-- -->. This should solve your problem. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:uf**************@TK2MSFTNGP04.phx.gbl...
>I think I found the problem but not why. It has to do with the fact that
HTML comments don't seem to work with asp.net.
I have the following page:
************************************************** ******
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" Inherits="MyFunctions.Page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<Script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim item as ListItem
Dim oLabel as Label
if not IsPostBack then
ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")
end if
end sub

Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs)
Dim pageError as Boolean = false
trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid & "
PageError = " & pageError)
If not Page.IsValid then
Exit Sub
End if
End Sub
</script>
<html>
<head>
<title>:: Staffing Workshop ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body id="myBody" runat="server">
<form runat="server">
<asp:TextBox ID="RequestedStartDate" Columns="12" runat="server"/>
<!-- <asp:CompareValidator runat="server" ID="ValidateDate"
ControlToValidate="RequestedStartDate"
Operator="GreaterThan"
Display="Dynamic"
Type="Date" text="<br>Invalid Start Date"/>
-->
<asp:ImageButton ImageUrl="../../buttons/submit_0.gif"
OnClick="SubmitNewHire_Click" runat="server"/>
</form>
</body>
</html>
************************************************** ***********

I should get an error here.

I have the Validator commented out but the line:

ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")

Still seems to work. I should get an error that says that there is no
such object ValidateDate (as it is commented out). If I delete the
Validator - I get the error.

If I take out the ValidateDate.ValueToCompare line, I get an error saying
that '' is not a valid date. Why would I get that error if this Validator
is commented out? I get this error as I am entering the page.

This was why I was getting the error.

I was putting in yesterdays date (which the validator says I can't do).
So the page is showing as not valid. But since the Validator is commented
out - the error message doesn't show (which it does if I don't comment it
out).

What gives?

Thanks,

Tom


Feb 22 '07 #5
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:ea**************@TK2MSFTNGP05.phx.gbl...
When commenting out an ASP.NET tag, you need to use <%-- --%rather
than <!-- -->. This should solve your problem. Good Luck!
That was the problem.

But why would it be set up that way? Why doesn't MS just use the normall
HTML comments.

Thanks,

Tom
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:uf**************@TK2MSFTNGP04.phx.gbl...
>>I think I found the problem but not why. It has to do with the fact that
HTML comments don't seem to work with asp.net.
I have the following page:
************************************************* *******
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" Inherits="MyFunctions.Page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<Script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim item as ListItem
Dim oLabel as Label
if not IsPostBack then
ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")
end if
end sub

Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs)
Dim pageError as Boolean = false
trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid & "
PageError = " & pageError)
If not Page.IsValid then
Exit Sub
End if
End Sub
</script>
<html>
<head>
<title>:: Staffing Workshop ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body id="myBody" runat="server">
<form runat="server">
<asp:TextBox ID="RequestedStartDate" Columns="12" runat="server"/>
<!-- <asp:CompareValidator runat="server" ID="ValidateDate"
ControlToValidate="RequestedStartDate"
Operator="GreaterThan"
Display="Dynamic"
Type="Date" text="<br>Invalid Start Date"/>
-->
<asp:ImageButton ImageUrl="../../buttons/submit_0.gif"
OnClick="SubmitNewHire_Click" runat="server"/>
</form>
</body>
</html>
************************************************* ************

I should get an error here.

I have the Validator commented out but the line:

ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")

Still seems to work. I should get an error that says that there is no
such object ValidateDate (as it is commented out). If I delete the
Validator - I get the error.

If I take out the ValidateDate.ValueToCompare line, I get an error saying
that '' is not a valid date. Why would I get that error if this
Validator is commented out? I get this error as I am entering the page.

This was why I was getting the error.

I was putting in yesterdays date (which the validator says I can't do).
So the page is showing as not valid. But since the Validator is
commented out - the error message doesn't show (which it does if I don't
comment it out).

What gives?

Thanks,

Tom



Feb 22 '07 #6
If the server code would remove all HTML comments, there would be no way
to put an HTML comment in the code.

tshad wrote:
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:ea**************@TK2MSFTNGP05.phx.gbl...
>When commenting out an ASP.NET tag, you need to use <%-- --%rather
than <!-- -->. This should solve your problem. Good Luck!

That was the problem.

But why would it be set up that way? Why doesn't MS just use the normall
HTML comments.

Thanks,

Tom
>--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:uf**************@TK2MSFTNGP04.phx.gbl...
>>I think I found the problem but not why. It has to do with the fact that
HTML comments don't seem to work with asp.net.
I have the following page:
************************************************ ********
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" Inherits="MyFunctions.Page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<Script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim item as ListItem
Dim oLabel as Label
if not IsPostBack then
ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")
end if
end sub

Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs)
Dim pageError as Boolean = false
trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid & "
PageError = " & pageError)
If not Page.IsValid then
Exit Sub
End if
End Sub
</script>
<html>
<head>
<title>:: Staffing Workshop ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body id="myBody" runat="server">
<form runat="server">
<asp:TextBox ID="RequestedStartDate" Columns="12" runat="server"/>
<!-- <asp:CompareValidator runat="server" ID="ValidateDate"
ControlToValidate="RequestedStartDate"
Operator="GreaterThan"
Display="Dynamic"
Type="Date" text="<br>Invalid Start Date"/>
-->
<asp:ImageButton ImageUrl="../../buttons/submit_0.gif"
OnClick="SubmitNewHire_Click" runat="server"/>
</form>
</body>
</html>
************************************************ *************

I should get an error here.

I have the Validator commented out but the line:

ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")

Still seems to work. I should get an error that says that there is no
such object ValidateDate (as it is commented out). If I delete the
Validator - I get the error.

If I take out the ValidateDate.ValueToCompare line, I get an error saying
that '' is not a valid date. Why would I get that error if this
Validator is commented out? I get this error as I am entering the page.

This was why I was getting the error.

I was putting in yesterdays date (which the validator says I can't do).
So the page is showing as not valid. But since the Validator is
commented out - the error message doesn't show (which it does if I don't
comment it out).

What gives?

Thanks,

Tom



--
Göran Andersson
_____
http://www.guffa.com
Feb 23 '07 #7
Those are the comments used in Classic ASP, so they kept the same ones to
make ASP.NET easier for developers to learn. Also, if you use Visual Studio
..NET there are buttons that you can use to comment or uncomment something.
These buttons will use the correct character depending on whether you are
editing the *.aspx file or the codebehind file.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:ea**************@TK2MSFTNGP05.phx.gbl...
>When commenting out an ASP.NET tag, you need to use <%-- --%rather
than <!-- -->. This should solve your problem. Good Luck!

That was the problem.

But why would it be set up that way? Why doesn't MS just use the normall
HTML comments.

Thanks,

Tom
>--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"tshad" <t@home.comwrote in message
news:uf**************@TK2MSFTNGP04.phx.gbl...
>>>I think I found the problem but not why. It has to do with the fact that
HTML comments don't seem to work with asp.net.
I have the following page:
************************************************ ********
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" Inherits="MyFunctions.Page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<Script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim item as ListItem
Dim oLabel as Label
if not IsPostBack then
ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")
end if
end sub

Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs)
Dim pageError as Boolean = false
trace.warn("Before Page.IsValid if Page.IsValid = " & Page.IsValid & "
PageError = " & pageError)
If not Page.IsValid then
Exit Sub
End if
End Sub
</script>
<html>
<head>
<title>:: Staffing Workshop ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body id="myBody" runat="server">
<form runat="server">
<asp:TextBox ID="RequestedStartDate" Columns="12" runat="server"/>
<!-- <asp:CompareValidator runat="server" ID="ValidateDate"
ControlToValidate="RequestedStartDate"
Operator="GreaterThan"
Display="Dynamic"
Type="Date" text="<br>Invalid Start Date"/>
-->
<asp:ImageButton ImageUrl="../../buttons/submit_0.gif"
OnClick="SubmitNewHire_Click" runat="server"/>
</form>
</body>
</html>
************************************************ *************

I should get an error here.

I have the Validator commented out but the line:

ValidateDate.ValueToCompare = DateTime.Today.ToString("yyyy-MM-dd")

Still seems to work. I should get an error that says that there is no
such object ValidateDate (as it is commented out). If I delete the
Validator - I get the error.

If I take out the ValidateDate.ValueToCompare line, I get an error
saying that '' is not a valid date. Why would I get that error if this
Validator is commented out? I get this error as I am entering the page.

This was why I was getting the error.

I was putting in yesterdays date (which the validator says I can't do).
So the page is showing as not valid. But since the Validator is
commented out - the error message doesn't show (which it does if I don't
comment it out).

What gives?

Thanks,

Tom




Feb 23 '07 #8

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

Similar topics

2
by: Matt Traxinger | last post by:
This is probably some really basic operation, but how do I view the source of a web page using a php script. For example I want to have a variable, say $url = "www.google.com"; Then I want...
3
by: David Graham | last post by:
hi Yesterday I posted the question below hoping someone could solve the basic problem at alt.html. Anyway, only one person replied and he thinks I'm best off just having a text only version for...
32
by: Howard Kaikow | last post by:
I often come upon web pages that do not allow themselves to be saved as a ..html file (complete), but do allow themselves to be saved as .mht files. In some cases, I find that there is no way to...
17
by: piraticman | last post by:
Hi. I have some code for a javascript jump menu... It validated with HTML 4.0 but now does not validate with XHTML strict 1.0. I have used name atributes in my code which aparantly are not...
1
by: Mark Olbert | last post by:
I've written a custom control that relies heavily on LinkButton controls. LinkButton controls don't behave properly under Netscape, but there's a simple patch/fix that involves registering some...
8
by: Anthony Williams | last post by:
Morning all, I'm having a wee problem with a project I'm working on at the moment. I'm leading my company into producing a website, based upon Web Standards, which will be created using XHTML...
5
by: John Bonds | last post by:
I'm having a dumb problem I put a few TextBoxes on a page and a few RequiredFieldValidators and a button. For some reason when I click the button, my browser still makes a round trip (postback)...
2
by: Carl Gilbert | last post by:
Hi I am developing a site that has 5 or 6 thumbnail pages each with 28 image on each. Each thumb nail has a matching larger image. So 5/6 groups of 28. When the user clicks on one of the...
5
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. ...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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.