How to avoid server side validation on client side click event? [modified]
-
Hi every body! I am developing application in ASP.NET 2.0 and C#. I have a page with few text boxes, i attached some required field and regular expression validators with text boxes. there are two buttons on page, one is "Submit" and other is "Cancel". when user clicks "Submit" button validators validate the conrols and every thing goes fine, i called client side click event on "Cancel" button which resets the values in text boxes. the problem is that when i press "Cancel" button the validators comes to action and gives error. Can any body tell me how to tackle this problem? Thanks in advance... Regards, Affan Ahmad Toor
.................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
modified on Wednesday, January 16, 2008 8:43:27 AM
-
Hi every body! I am developing application in ASP.NET 2.0 and C#. I have a page with few text boxes, i attached some required field and regular expression validators with text boxes. there are two buttons on page, one is "Submit" and other is "Cancel". when user clicks "Submit" button validators validate the conrols and every thing goes fine, i called client side click event on "Cancel" button which resets the values in text boxes. the problem is that when i press "Cancel" button the validators comes to action and gives error. Can any body tell me how to tackle this problem? Thanks in advance... Regards, Affan Ahmad Toor
.................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
modified on Wednesday, January 16, 2008 8:43:27 AM
Affan Toor wrote:
the problem is that when i press "Cancel" button the validators comes to action and gives error.
Did you consider setting
CausesValidation
to false for the cancel button?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Affan Toor wrote:
the problem is that when i press "Cancel" button the validators comes to action and gives error.
Did you consider setting
CausesValidation
to false for the cancel button?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis LevinsonThanks for reply, i have rechecked, CausesValidation is set to false for cancel button...
.................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
-
Hi every body! I am developing application in ASP.NET 2.0 and C#. I have a page with few text boxes, i attached some required field and regular expression validators with text boxes. there are two buttons on page, one is "Submit" and other is "Cancel". when user clicks "Submit" button validators validate the conrols and every thing goes fine, i called client side click event on "Cancel" button which resets the values in text boxes. the problem is that when i press "Cancel" button the validators comes to action and gives error. Can any body tell me how to tackle this problem? Thanks in advance... Regards, Affan Ahmad Toor
.................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
modified on Wednesday, January 16, 2008 8:43:27 AM
You need to check
ValidationGroup
property. Set same validation group name for your validators and submit button. Don't set any validation group for cancel button. This will solve the problem.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions