Client Side Validation

ASP.NET automatically adds JavaScript code for client side validation.In this case, when the user clicks a CausesValidation button, the same error message will appear without the page needing to be submitted and returned from the server.This increase the representation of your web page.
However, even if the page validates successfully on the client side,ASP.NET still revalidates it when it's received at the server.This is because it's easy for an experienced user to circumvent client side validation. For example, a malicious user might delete the block of JavaScript validation. For example, a malicious user might delete the block of JavaScript validation code and continue working with the page.By performing the validation at both ends,ASP.NET makes sure your application can be responsive as possible while also remaining secure.

Server Side Validation

You can use the validator controls to verify a page automatically when the user submits it or manually in your code.The first approach is the most common.
When using automatic validation,the user receive a normal page and begins to fill in the input controls. When finished, the user clicks a button to submit the page.Every button has a causes Validation property, which can be set to true or false.What happens when the user clicks the button depends on the value of the CausesValidation property.

  • If CausesValidation is false, ASP.NET will ignore the validation controls,the page will be posted back,and your event-handling code will run normally.
  • If CausesValidation is true(the default), ASP.NET will automatically validate the page when the user clicks the button. It does this by performing the validation for each control on the page. If any control fails to validate, ASP.NET will return the page with some error information,depending on your setting.Your click event-handling code may or may not be executed-meaning you'll have to specifically check in the event handler whether the page is valid.