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 CustomValidator

About CustomValidator

Scheduled Pinned Locked Moved ASP.NET
cryptographytutorialquestion
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.
  • J Offline
    J Offline
    jason_mf
    wrote on last edited by
    #1

    How to write client-side validation code? E.G. a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt) identityDdl has 3 items: Indentity Card, Martial Certificate and other when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check. if the characters more than 300 of remarkTxt. With CustomValidator How to validat on client? How to verify the results back to the CustomValidator? Thanks.

    B 1 Reply Last reply
    0
    • J jason_mf

      How to write client-side validation code? E.G. a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt) identityDdl has 3 items: Indentity Card, Martial Certificate and other when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check. if the characters more than 300 of remarkTxt. With CustomValidator How to validat on client? How to verify the results back to the CustomValidator? Thanks.

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      You can use javascript for it.get the control by its ID,then check the value and for correct format you can REGEX.

      Cheers!! Brij

      J 1 Reply Last reply
      0
      • B Brij

        You can use javascript for it.get the control by its ID,then check the value and for correct format you can REGEX.

        Cheers!! Brij

        J Offline
        J Offline
        jason_mf
        wrote on last edited by
        #3

        I saw so many people write like this:

        <script type="text/javascript">

        function valComments\_ClientValidate(source, args)
        
        {
        
            if (args.Value.length > 10)
        
                args.IsValid = false;
        
            else
        
                args.IsValid = true;
        
        }
        
        
        
        </script>
        

        But I try it not successful. How to setting the page validat is true or false?

        N 1 Reply Last reply
        0
        • J jason_mf

          I saw so many people write like this:

          <script type="text/javascript">

          function valComments\_ClientValidate(source, args)
          
          {
          
              if (args.Value.length > 10)
          
                  args.IsValid = false;
          
              else
          
                  args.IsValid = true;
          
          }
          
          
          
          </script>
          

          But I try it not successful. How to setting the page validat is true or false?

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

          This looks OK. Do you have firebug installed? If yes, try to debug your JS.

          Navaneeth How to use google | 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