I have thought all along that I should validate form data on JavaScript when I click the submit button and after that moreover I should validate data submitted on server side C#.
But now I’m thinking that probably I don’t need to validate form data on JavaScript? Because the page doesn’t be reloaded anyway thanks to Ajax which means there is no difference for users between error message from JavaScript and error message from C#.
Strange thinking??
Always implement validation on the server side. Then make sure that this validation works before even thinking about client side validation. The reason for this is that I have seen many people implement client side validation first and then forget about the server side validation thinking that they are validating something. Client side validation should not really be seen as validation. It should be seen as something that allows to improve the user experience (the user gets immediate feedback without the need to submit the entire form) and preserve bandwidth. So if you want this extra then go ahead and implement client side validation.