SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript (Select an Item in DropDownList)

    Hi!

    I have a Page, where, I have two Controls a Label and a Dropdown List.

    Value of Label is "C"

    Items of DropDownList are "A", "B", "C", "D". By default, the first item i.e. "A" is selected in the dropdown.

    Now, when I click on a 'Link', whatever is the Text in the Label (in this case 'C'), should get selected on the dropdownlist.

    I need to achieve this using Javascript. Help.

    P.S. - All these controls are within the GridView.

    Following gives, me the text of the Label.

    var label1 = document.getElementById(lbl1).innerHTML.

    But, how to make the selected item on the dropdown , what I get in lable1.

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you provide more code and clarify what your label is? Is it a label ELEMENT ? Does it have a value attribute or is that just TEXT? What specific controls?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •