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. DropDownList select [modified]

DropDownList select [modified]

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 4 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.
  • L Offline
    L Offline
    lehya
    wrote on last edited by
    #1

    I have two dropdownlist for one choice..Like Height is taken in feet and in cms. When a user selects either of feet or cms the page becomes valid if not it will throw the relevant error in validation summary.... How should I implement this now..... The code goes here.... -in Cms- 137cms 138cms How shall i implement requiredfieldvalidator that checks whether either of this one is selected r not....and throws error in validation summary if not selected

    P S 2 Replies Last reply
    0
    • L lehya

      I have two dropdownlist for one choice..Like Height is taken in feet and in cms. When a user selects either of feet or cms the page becomes valid if not it will throw the relevant error in validation summary.... How should I implement this now..... The code goes here.... -in Cms- 137cms 138cms How shall i implement requiredfieldvalidator that checks whether either of this one is selected r not....and throws error in validation summary if not selected

      P Offline
      P Offline
      postmaster programmingknowledge com
      wrote on last edited by
      #2

      In requiredfieldvalidator there is a property 'ControlToValidate' Set this property to your dropdown control to validate. Set 'ErrorMessage'. You may need to set 'InitialValue' to 0. Good Luck. http://www.programmingknowledge.com/[^]

      L 1 Reply Last reply
      0
      • P postmaster programmingknowledge com

        In requiredfieldvalidator there is a property 'ControlToValidate' Set this property to your dropdown control to validate. Set 'ErrorMessage'. You may need to set 'InitialValue' to 0. Good Luck. http://www.programmingknowledge.com/[^]

        L Offline
        L Offline
        lehya
        wrote on last edited by
        #3

        As been told, how can one requiredfieldvalidator check for two dropdownlistboxes? Initial value is set but it doesnt make a difference at all..

        _ 1 Reply Last reply
        0
        • L lehya

          As been told, how can one requiredfieldvalidator check for two dropdownlistboxes? Initial value is set but it doesnt make a difference at all..

          _ Offline
          _ Offline
          _AK_
          wrote on last edited by
          #4

          Hi, You can use custom validation control for that. You write the validation in javascript. There you check accordingly. Hope this helps you. Best Regards, Apurva Kaushal

          1 Reply Last reply
          0
          • L lehya

            I have two dropdownlist for one choice..Like Height is taken in feet and in cms. When a user selects either of feet or cms the page becomes valid if not it will throw the relevant error in validation summary.... How should I implement this now..... The code goes here.... -in Cms- 137cms 138cms How shall i implement requiredfieldvalidator that checks whether either of this one is selected r not....and throws error in validation summary if not selected

            S Offline
            S Offline
            Sushant Duggal
            wrote on last edited by
            #5

            Hi, You can use javascript for this: function checkDropDowns() { var ddl1 = document.getElementById('ddl1'); var ddl2 = document.getElementById('ddl2'); if(ddl1.options[0].selected == true && ddl2.options[0].selected == true) { alert("Please Select One Value From Atleast One DropDown Box!!"); return false; } } I guess this works for you, Thanks Sushant Duggal.

            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