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. about the use of validator control in asp.net

about the use of validator control in asp.net

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelp
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.
  • S Offline
    S Offline
    Seraph_summer
    wrote on last edited by
    #1

    I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!

    A E 2 Replies Last reply
    0
    • S Seraph_summer

      I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Seraph_summer wrote:

      I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions?

      Yes, That is ValidationGroup Property In your case, Textbox, Submit button and RequiredFiledValidator Should have same ValidationGroup. For your Referecne : VAlidation Group[^] Hope this will help you :-D

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

      1 Reply Last reply
      0
      • S Seraph_summer

        I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!

        E Offline
        E Offline
        en Mahdi
        wrote on last edited by
        #3

        I think you can put the textbox and button in a same validationGroup .

        S 1 Reply Last reply
        0
        • E en Mahdi

          I think you can put the textbox and button in a same validationGroup .

          S Offline
          S Offline
          Seraph_summer
          wrote on last edited by
          #4

          thanks for both o you! I got it!

          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