You must Sign In to post a response.

Use of causesValidation property for controls

Hi friends,

What is the use of CausesValidation property which is available for controls?

if we set it to true what will happen and if not what will happen?

Thanks in Advance


Author: venkatesan.M27 Jan 2009 Member Level: Gold   Points : 2

To prevent validation to occur on the click of the Cancel button, set the ‘CausesValidation’ property to false

Suppose if u want a validation set CauseVAlidation="True"

Author: moturi 27 Jan 2009 Member Level: Gold   Points : 1

If you dont want the validation for the button then you can set the CausesValidation property to false

Author: soubhagya kumar sahu27 Jan 2009 Member Level: Bronze   Points : 1

To make validation all false, u have to make cause validation property set to false.Ex: in cancel button's click event.

Author: seenu27 Jan 2009 Member Level: Gold   Points : 3

Hi !

if cause validation=true;

incause delete button u set the alert msg by then click save button open the deletebutton alert msg.....

e.g : alert msg

btnDelete.Attributes.Add("onclick","return confirm('Are you sure you want to delete this record?');");

To avoid this problem set remaining button cause validation=false;

Author: Gaurav Kumar Arora27 Jan 2009 Member Level: Gold   Points : 4


In simple words causevalidation=true tells that when the same button is pressed/clicked then all validators should be true.

In other words if you have set causevalidation=true on a Button then whenever you clicked the button or whenever the click event if fire of that button the all validations checkd once and page processed if they return true else generate validation error(s).

Hope the above is okie for you.

In above replies you already went through the syntaxes.

Best of luck!

Author: jeya sakthi vel murugan27 Jan 2009 Member Level: Gold   Points : 4

Definition and Usage

The CausesValidation property specifies if a page is validated when a Button control is clicked.

Page validation is performed when a button is clicked by default.

This property is mostly used to prevent validation when a cancel or reset button is clicked.


The following example removes validation when a button is clicked:

CausesValidation="FALSE" Text="Cancel" />

Author: Nisar28 Jan 2009 Member Level: Gold   Points : 2

causesvalidation false property is used when you don't want to validate the control,
For example if you want set required field validation on textbox, but if you make textbox causesvalidation property false then required field validation doesn't work.

Sign In to post your comments