1

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?

enter image description here

1
  • 3
    always validate server-side, because everything client-side can be manipulated. server-side validation is functional, client-side validation is just convenience Commented Jun 10, 2021 at 20:37

2 Answers 2

2

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 :

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.