473,722 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shouldn't server validation always occur when CausesValidatio n is true??

I recently had a problem where my required field validator stopped working.
But, the page still posted back and tried to insert a record into the
database without performing server-side validation. I discovered that there
was no aspnet_client folder in the root of my IIS Web site, and when I ran
"aspnet_reg iis -c", client-side validation was working again. However, what
I don't understand is why the required field validator did not validate on
the server.

I have a Button WebControl with CausesValidatio n = True and a
RequiredFieldVa lidator with EnableClientScr ipt = True. I thought that
client-side validation provided a nice user experience and reduced
postbacks, but that server-side validation was ALWAYS performed.

Can someone explain why not having the aspnet_client folder would then cause
server-side validation to stop working???

Also, on my Windows 2000 Server SP4, the following javascript code is
emitted in the page in question (even after restoring aspnet_client):

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if ((typeof(Page_V alidationVer) != "undefined" ) && (Page_Validatio nVer
== "125"))
ValidatorOnLoad ();
}
-----------------------------------

But on my windows XP Pro SP2 development machine, the following code is
emitted in this page:

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if (typeof(Page_Va lidationVer) == "undefined" )
alert("Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation .js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.");
else if (Page_Validatio nVer != "125")
alert("This page uses an incorrect version of WebUIValidation .js.
The page expects version 125. The script library is " + Page_Validation Ver +
".");
else
ValidatorOnLoad ();
}
-----------------------------------

If the Win2k server had emitted the checks and alert() lines, I would have
been able to find the cause of the problem much quicker. Does anyone know
what accounts for the difference and what I can do to get my server to emit
the second code fragment???
Feb 28 '06 #1
2 4516
for serverside validation to run, your backend code must call it, say thru
accessing the IsValid property which in turn will fire the validation
routines.

-- bruce (sqlwork.com)

"dustbort" <dustbort at yahoo dot com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
I recently had a problem where my required field validator stopped working.
But, the page still posted back and tried to insert a record into the
database without performing server-side validation. I discovered that
there was no aspnet_client folder in the root of my IIS Web site, and when
I ran "aspnet_reg iis -c", client-side validation was working again.
However, what I don't understand is why the required field validator did
not validate on the server.

I have a Button WebControl with CausesValidatio n = True and a
RequiredFieldVa lidator with EnableClientScr ipt = True. I thought that
client-side validation provided a nice user experience and reduced
postbacks, but that server-side validation was ALWAYS performed.

Can someone explain why not having the aspnet_client folder would then
cause server-side validation to stop working???

Also, on my Windows 2000 Server SP4, the following javascript code is
emitted in the page in question (even after restoring aspnet_client):

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if ((typeof(Page_V alidationVer) != "undefined" ) && (Page_Validatio nVer
== "125"))
ValidatorOnLoad ();
}
-----------------------------------

But on my windows XP Pro SP2 development machine, the following code is
emitted in this page:

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if (typeof(Page_Va lidationVer) == "undefined" )
alert("Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation .js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.");
else if (Page_Validatio nVer != "125")
alert("This page uses an incorrect version of WebUIValidation .js.
The page expects version 125. The script library is " + Page_Validation Ver
+ ".");
else
ValidatorOnLoad ();
}
-----------------------------------

If the Win2k server had emitted the checks and alert() lines, I would have
been able to find the cause of the problem much quicker. Does anyone know
what accounts for the difference and what I can do to get my server to
emit the second code fragment???

Feb 28 '06 #2
No, I don't think so. From the .NET Framework Class Library under
Button.CausesVa lidation Property:

"By default [CausesValidatio n = True], page validation is performed when a
Button control is clicked. Page validation determines whether the input
controls associated with a validation control on the page all pass the
validation rules specified by the validation control."

This means that page validation is automatically performed when when
CausesValidatio n = True.
My understanding is that you only have to explicitly call Validate() and
check IsValid if you have set CausesValidatio n = False because you want to
do selective validation. In my case, CausesValidatio n = True . So why
didn't the page validate on the server?

"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:ek******** ******@TK2MSFTN GP11.phx.gbl...
for serverside validation to run, your backend code must call it, say thru
accessing the IsValid property which in turn will fire the validation
routines.

-- bruce (sqlwork.com)

"dustbort" <dustbort at yahoo dot com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
I recently had a problem where my required field validator stopped
working. But, the page still posted back and tried to insert a record into
the database without performing server-side validation. I discovered that
there was no aspnet_client folder in the root of my IIS Web site, and when
I ran "aspnet_reg iis -c", client-side validation was working again.
However, what I don't understand is why the required field validator did
not validate on the server.

I have a Button WebControl with CausesValidatio n = True and a
RequiredFieldVa lidator with EnableClientScr ipt = True. I thought that
client-side validation provided a nice user experience and reduced
postbacks, but that server-side validation was ALWAYS performed.

Can someone explain why not having the aspnet_client folder would then
cause server-side validation to stop working???

Also, on my Windows 2000 Server SP4, the following javascript code is
emitted in the page in question (even after restoring aspnet_client):

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if ((typeof(Page_V alidationVer) != "undefined" ) && (Page_Validatio nVer
== "125"))
ValidatorOnLoad ();
}
-----------------------------------

But on my windows XP Pro SP2 development machine, the following code is
emitted in this page:

-----------------------------------
if (typeof(clientI nformation) != "undefined" &&
clientInformati on.appName.inde xOf("Explorer") != -1) {
if (typeof(Page_Va lidationVer) == "undefined" )
alert("Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation .js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.");
else if (Page_Validatio nVer != "125")
alert("This page uses an incorrect version of WebUIValidation .js.
The page expects version 125. The script library is " +
Page_Validation Ver + ".");
else
ValidatorOnLoad ();
}
-----------------------------------

If the Win2k server had emitted the checks and alert() lines, I would
have been able to find the cause of the problem much quicker. Does
anyone know what accounts for the difference and what I can do to get my
server to emit the second code fragment???


Feb 28 '06 #3

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

Similar topics

2
1761
by: Marina | last post by:
Hi, Here is the desire behavior, when the user tries to leave a field, that field is validated. If the value in the field is invalid, the previous value is restored - however, the user is allowed to go on to the next field anyway. It seems that the Validating event has the behavior of keeping the user in the field if e.Cancel is set to True - and doesn't replace the bad value with the last good one. Which is all very undesirable! It...
4
2565
by: RobS | last post by:
Can anyone answer this question: How can I disable validation when edit column update button is pressed. Can it be done for the whole grid? Regards, Robert
4
10145
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all the validators. The user enters the data, presses OK. My OK button is dynamically generated as well, with some code-behind logic in
3
2424
by: interuser | last post by:
Hi How can I prevent an event (eg button click) from happening from within page_load? The reason is that I want to make my existing application work for netscape, for which there are no client side validations. So I thought to put something like the following in the superclass of all UI pages: public sub page_load
2
2246
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course SessionUserControl.ascx - select or enter a course session CourseDetails.aspx - a form which contains just CourseUserControl CourseSessionDetails.aspx - a form which contains just SessionUserControl TrainingRequestDetails.aspx - a form which includes...
9
2223
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see) in page_load, or elsewhere, that says page.validate, no control says "causesvalidation=true", and the AutoEventWireup is set to false. So I would think that the control's server event function would NOT execute, but it does execute right after...
4
2976
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are linkbuttons which must not cause validation. I have found a setting "causeValidation" to disable the validation. Also on the page, I have a datagrid that I will edit lines on. I can click
5
2056
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design time property of causevalidation. How can I keep them from causing validation? Thanks, T
5
3815
by: Micky | last post by:
VB v7.1.3088 NET v1.1.4322 SP1 My mate has a strange problem regarding the ESC key and validation. When he hits the Cancel button on his form, the form does not validate. This is correct behaviour of course. However, he also wants this same behaviour when hitting ESC on the keyboard. It was my understanding that when you assign a button to a form's CancelButton property you automatically gained this functionality. However,
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.