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. populating ddl using javascript

populating ddl using javascript

Scheduled Pinned Locked Moved ASP.NET
javascripttutorial
3 Posts 2 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.
  • A Offline
    A Offline
    abulhassan_shock
    wrote on last edited by
    #1

    using javascript, i have to populate a dropdownlist text and its values. for that i am getting name and its values in two variables namely "name" and "id". the ddl text is populated using this code, document.Auto.ddlComp.options[i] = new Option(name); // working fine but to populate its correspoding values for text i used, // document.Auto.ddlComp.options[i].value = new Option(id); its not working. please tell me how to populate the corresponding ddl values to its text. Regards, abul.

    hello

    E 1 Reply Last reply
    0
    • A abulhassan_shock

      using javascript, i have to populate a dropdownlist text and its values. for that i am getting name and its values in two variables namely "name" and "id". the ddl text is populated using this code, document.Auto.ddlComp.options[i] = new Option(name); // working fine but to populate its correspoding values for text i used, // document.Auto.ddlComp.options[i].value = new Option(id); its not working. please tell me how to populate the corresponding ddl values to its text. Regards, abul.

      hello

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      if memory serves, you can do it when creating the option item: new Option(text,value,defaultSelected,selected);

      A 1 Reply Last reply
      0
      • E ednrgc

        if memory serves, you can do it when creating the option item: new Option(text,value,defaultSelected,selected);

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

        thanks edboe...

        hello

        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