ASP.Net Validation controls

ASP.Net validation controls can be used to perform both client side validations. If the page containing a validation control is rendered in a page with Javascript disabled, the runtime creates code to automatically perform the validations in the server side.

Server side validations can be invoked using the Page.Validate() method. The status of the validation is set to the Page.IsValid property by the runtime.

protected void Page_Load(object sender, EventArgs e)
if (Page.IsPostBack)

protected void button1_Click(object sender, EventArgs e)
if (!Page.IsValid) return;
//Do something if validation passes.

This server side validation works on all major browsers. I have tested on IE, FireFox and Netscape.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s