[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ASP.NET VALIDATION (Client verse Server)

Posted on 2004-03-23
4
Medium Priority
?
259 Views
Last Modified: 2010-04-17
I am having some trouble understanding what the ASP.NET validation controls actually do.

Do they validate on the client, the server, or both?

I understand the customvalidator has an event called onServerValidate which can be used to trigger server validation.  

But what about the requiredfieldvalidator, rangevalidator, etc, etc.  There is a setting that says EnableClientScript.  I have set this to false and have mixed results.  In some cases the validation doesn't work anymore and in other cases it works fine.  

I don't know if I should be creating client and server side validation routines.  If so, how do I do both at the same time?
0
Comment
Question by:ijenkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
minermadison earned 1000 total points
ID: 10663284
ASP.Net Validation controls generate client side JavaScript, when the 'EnableClientScript' is set to true the script is in an .js file located at

http://localhost/...SiteName.../aspnet_client/system_web/1_1_4322/WebUIValidation.js

Most all users have Javascript enabled to you should be safe using the 'EnableClientScript'. This way, when the user presses the 'submit' button, validation takes place immedaitly on the clients machine, otherwise a round trip to the server is made, possibly just to send the page back with some red ink telling the user that a field value is incorrect.

The best practice I've found is to use the ValidationControls with the client script. And also write some server based code to double check the values, if they don't look write you can take the appropraite action.
0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 1000 total points
ID: 10663578
You do not need to 'create client and server' validation routines.  Just create the 'validation' routine, as is, and ASP.NET will take care of what is needed.  (actually, the validation is 'normally' done on BOTH sides - using the same code, as provided by you).

AW
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question