I'm making an asp.net app for user to enter database data. I want to make sure the data is valid e.g. certain field needs to have max 2 decimal or has max value of 100 etc. Do I check for valid data in javascript or in C# since I am using jquery datatable?
2 Answers
You should use both validations. JQuery validation has a faster speed and it checks the validation on the client-side and didn't send any information to the server. But in many cases, users turn off the javascript of the browser and it's too dangerous if you don't check it by c#(server-side) validation.
You can also read the links below :
Comments
you can go for both if you want. the client-side validation is not safe since can be disabled by client user but brings nice user experience since it prevents the form with invalid data to be submited at the beginning and avoid reloading or call any thing backend and keeps it idle.
How ever along side that implement server-side validation in case of client-side failure due to any reason.
if you want choose one of them .. of course it must be server-side.
