Forum Moderators: open
However, when I click on the Edit button of the dataGrid, make my changes and click the Enter button of the datagrid, the validation still kicks in and won't let me submit.
I did a work around by putting the validation in the codeBehind instead of in a control.
Is that the best solution?
I really want a personal guru.....8(
You might also want to set all the Validation controls on the page to have EnableClientScript turned off. This will cause all validation to be done server side.
One question about the EnableClientScript = false idea.
The reason .NET put the validation in both client and server was for older browsers that couldn't do client side. The prefered method is client side.
Client side is faster, but is there much of a loss doing it only server side?
Although client side validation gives a "more interactive feel", any time you have extensive JavaScript (and client side validation is fairly extensive), you have the risk that the client side code won't work in some browser.
Regardless of whether you choose client or server side, make sure that all of the validation controls on the page have the EnableClientScript property set the same way. It is a weird user experience to fix what they see as all the errors on their form as shown by client side validation, then have the server side validation rules kick in and give them a whole new batch of errors.
Personally, I don't find the benefits of client side validation to outweigh the risk, and in many cases the user can't tell the difference.
I have to partially disagree with you. (First I'll make my former point clear: Server-side (SS) validation is a must, client-side (CS) is a bonus).
If you have the opportunity to perform CS validation, you absolutely should do it, if not for the "interactive" factor, then to at least save server resources.
I frankly don't buy the "might not work in some browsers" bit. If you develop it, you always make sure it works in all browsers (or whatever you deem is necessary; everyone has their limits). Just because the time won't be taken to browser-check your code, doesn't mean you shouldn't do it. JavaScript is actually quite flexible across browsers, and you should hardly every run into any problems with compatibility (especially if you're just performing form validation).
If you have 1 million visitors per month to a registration page on your site, and 10% have an error that could have been caught via CS validation, that's 100,000 form posts that could have been saved, and those server resources not used.
While I agree it's personal preference as to your choice for CS validation, I think it should be highly considered.
I always agreee that CS validation is the first choice though to make it faster for the user. There is no need for a trip to the server only to find out a phone number was missing.
I think my personal issue above will be solved by using a Template inside the DG.