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. Compare Validator

Compare Validator

Scheduled Pinned Locked Moved ASP.NET
helpquestion
6 Posts 5 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.
  • F Offline
    F Offline
    FEMDEV
    wrote on last edited by
    #1

    Hi, I have a compare validator which compares the email and confirm email text boxes on my page. Is there anyway that I could trim the spaces at the start and end of these email address and then get them compared by the control? As is expected, It gives error if there is space at the end of either text boxes. Thanks

    B P D 4 4 Replies Last reply
    0
    • F FEMDEV

      Hi, I have a compare validator which compares the email and confirm email text boxes on my page. Is there anyway that I could trim the spaces at the start and end of these email address and then get them compared by the control? As is expected, It gives error if there is space at the end of either text boxes. Thanks

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

      I dont think it is possible.You can use custome validator for this

      Cheers!! Brij

      1 Reply Last reply
      0
      • F FEMDEV

        Hi, I have a compare validator which compares the email and confirm email text boxes on my page. Is there anyway that I could trim the spaces at the start and end of these email address and then get them compared by the control? As is expected, It gives error if there is space at the end of either text boxes. Thanks

        P Offline
        P Offline
        Pranay Rana
        wrote on last edited by
        #3

        on thing you can do is use onblur event and create one javascript function which remove white space from the text box hope this will help you

        1 Reply Last reply
        0
        • F FEMDEV

          Hi, I have a compare validator which compares the email and confirm email text boxes on my page. Is there anyway that I could trim the spaces at the start and end of these email address and then get them compared by the control? As is expected, It gives error if there is space at the end of either text boxes. Thanks

          D Offline
          D Offline
          Dinesh Mani
          wrote on last edited by
          #4

          Adding to Pranay Rana's solution, trim the spaces in a javascript function on blur and then trigger the validation using the Page_ClientValidate() method to ensure that the compare validation is done after the trim. HTH!

          F 1 Reply Last reply
          0
          • F FEMDEV

            Hi, I have a compare validator which compares the email and confirm email text boxes on my page. Is there anyway that I could trim the spaces at the start and end of these email address and then get them compared by the control? As is expected, It gives error if there is space at the end of either text boxes. Thanks

            4 Offline
            4 Offline
            4anusha4
            wrote on last edited by
            #5

            string s=Textbox.Text.TrimEnd().TrimStart();

            1 Reply Last reply
            0
            • D Dinesh Mani

              Adding to Pranay Rana's solution, trim the spaces in a javascript function on blur and then trigger the validation using the Page_ClientValidate() method to ensure that the compare validation is done after the trim. HTH!

              F Offline
              F Offline
              FEMDEV
              wrote on last edited by
              #6

              Thanks all.

              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