Powered by Blogger.

Thursday, February 27, 2014

jQuery or validation controls? which should be used for validation?



In this post we will discuss about which type of validation we should use in our Asp.Net applications. Whether we should use jQuery or JavaScript validation or we should use our inbuilt Asp.Net validation controls.

Also you can check out some of my articles on:

- Change authentication mode after installation of SQL Server

- Different ways to encrypt or decrypt password in asp.net

- Functions and Subroutines in C#.Net

- It depends on how rich client you want to build and It's entirely a performance optimization. A client validation (jQuery/javascript) failure saves a round trip to your server, helping to scale and allowing to reduce the response time for users. But some cases validation work must take place server-side (For example : Date Validation).

- If you want to make a secure application, validation has to be done on both sides, client and server. Remember client side, especially javascript can always be hacked from the browsers by a user.

- Also it depends on how much control you have over the entire page content. JavaScript can not only be hacked, but easily broken by content that another developer or dynamic content adds to the page. In addition, JQuery is still seen as a technical skill that many web developers do not possess (unfortunately) which will make it more difficult to maintain.

- ASP.Net validation controls help you automate the server-side validation and keep it in sync with the client, while jQuery still requires you to write the server-side logic separately.

- ASP.Net validation controls help you automate the server-side validation and keep it in sync with the client, while jQuery still requires you to write the server-side logic separately.

- Validation should be done on client side and server side for added security, protecting the application from undesired data. Some in this forum think that JQuery is a skill or its hard. To simply put it, JQuery is a framework that has been around a few years, and it wraps DOM object manipulation that is browser safe. JQuery's biggest challenge is the selector, once you master that, you are ready to take on the world.