Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to avoid server side validation on client side click event? [modified]

How to avoid server side validation on client side click event? [modified]

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netsysadminregex
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Affan Toor
    wrote on last edited by
    #1

    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

    V N 2 Replies Last reply
    0
    • A Affan Toor

      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

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • V Vasudevan Deepak Kumar

        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

        A Offline
        A Offline
        Affan Toor
        wrote on last edited by
        #3

        Thanks for reply, i have rechecked, CausesValidation is set to false for cancel button...

        .................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!

        1 Reply Last reply
        0
        • A Affan Toor

          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

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups