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. Enable / Disable Regular Expression Validator based on Dropdownlist selection

Enable / Disable Regular Expression Validator based on Dropdownlist selection

Scheduled Pinned Locked Moved ASP.NET
javascriptregexhelp
4 Posts 4 Posters 1 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.
  • P Offline
    P Offline
    priyaahh
    wrote on last edited by
    #1

    Hi Friends, I have DropdownList, Textbox and RegularExpression Validator in Gridview's ItemTemplate. RegularExpressionValidator is to validate the percentage in Textbox entry. This RegularExpressValidator should enable only based on dropdownlist selection. i.e., if dropdownlist selection is "Percentage" then, validator should enable to validate textbox entry. I have tried many ways in Javascript and .cs code, but no luck. Please help in this. Regards, Priyaa.

    B A W 3 Replies Last reply
    0
    • P priyaahh

      Hi Friends, I have DropdownList, Textbox and RegularExpression Validator in Gridview's ItemTemplate. RegularExpressionValidator is to validate the percentage in Textbox entry. This RegularExpressValidator should enable only based on dropdownlist selection. i.e., if dropdownlist selection is "Percentage" then, validator should enable to validate textbox entry. I have tried many ways in Javascript and .cs code, but no luck. Please help in this. Regards, Priyaa.

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

      Replace you RegularExpression Validator with a Custom Validator, then you can use string.match js method to validate you textbox. here is a link on how to use the string.match() method: string.match()

      1 Reply Last reply
      0
      • P priyaahh

        Hi Friends, I have DropdownList, Textbox and RegularExpression Validator in Gridview's ItemTemplate. RegularExpressionValidator is to validate the percentage in Textbox entry. This RegularExpressValidator should enable only based on dropdownlist selection. i.e., if dropdownlist selection is "Percentage" then, validator should enable to validate textbox entry. I have tried many ways in Javascript and .cs code, but no luck. Please help in this. Regards, Priyaa.

        A Offline
        A Offline
        Ajay_Saini
        wrote on last edited by
        #3

        Hi, you can use dropdown selected index changed event on dropdownlist. means if your regular expression validator id is regular1 then just false its visibility from server side as reqular1.Visible=false; try it. this can also done by Jquery.

        1 Reply Last reply
        0
        • P priyaahh

          Hi Friends, I have DropdownList, Textbox and RegularExpression Validator in Gridview's ItemTemplate. RegularExpressionValidator is to validate the percentage in Textbox entry. This RegularExpressValidator should enable only based on dropdownlist selection. i.e., if dropdownlist selection is "Percentage" then, validator should enable to validate textbox entry. I have tried many ways in Javascript and .cs code, but no luck. Please help in this. Regards, Priyaa.

          W Offline
          W Offline
          www Developerof NET
          wrote on last edited by
          #4

          Hi, This can be achieved by using the inbuilt ValidatorEnable function. Refer http://msdn.microsoft.com/en-us/library/aa479045.aspx[^] for more information.

          When you fail to plan, you are planning to fail.

          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