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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Higlight dropdown list item when i select 2nd dropdown list

Higlight dropdown list item when i select 2nd dropdown list

Scheduled Pinned Locked Moved ASP.NET
helptutorial
4 Posts 3 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
    pavanip
    wrote on last edited by
    #1

    Hi, I am having 2 dropdown lists 1st dropdownlist contains A-Z list.2nd dropdown list contains some names like akila,bindu,chinni,....zibra etc. when i select name in 2nd dropdown list, the first letter of that name should be highlight in 1st dropdown.eg. i select chinni then "C" should be highlight in 1st dropdown. Please help me how to resolve this problem. Thanks in advance Pavani

    V S 2 Replies Last reply
    0
    • P pavanip

      Hi, I am having 2 dropdown lists 1st dropdownlist contains A-Z list.2nd dropdown list contains some names like akila,bindu,chinni,....zibra etc. when i select name in 2nd dropdown list, the first letter of that name should be highlight in 1st dropdown.eg. i select chinni then "C" should be highlight in 1st dropdown. Please help me how to resolve this problem. Thanks in advance Pavani

      V Offline
      V Offline
      Vengatachalapathy Palanivel
      wrote on last edited by
      #2

      you can make use of Javascripts functions to solve this problem. On change event of second dropdown, call a Jscript function. In this Jscript function identify the selected value and based on it select the appropriate value in first dropdown. Hope this helps you.

      Regards, Vengat P

      1 Reply Last reply
      0
      • P pavanip

        Hi, I am having 2 dropdown lists 1st dropdownlist contains A-Z list.2nd dropdown list contains some names like akila,bindu,chinni,....zibra etc. when i select name in 2nd dropdown list, the first letter of that name should be highlight in 1st dropdown.eg. i select chinni then "C" should be highlight in 1st dropdown. Please help me how to resolve this problem. Thanks in advance Pavani

        S Offline
        S Offline
        Sneha Bisht
        wrote on last edited by
        #3

        On 2nd dropdownlist selectedEvent you find dropdownlist2.selectedItem.Text . then this value assign to a string value ch ; now use the split function in string ch and find first letter if the string . then use dropdownlist2.items.findbyText("XXX").selected = true ; here XXX = first letter of the string and first dropdownlist must contains A-Z Alphabates . Thankx if it helps .

        P 1 Reply Last reply
        0
        • S Sneha Bisht

          On 2nd dropdownlist selectedEvent you find dropdownlist2.selectedItem.Text . then this value assign to a string value ch ; now use the split function in string ch and find first letter if the string . then use dropdownlist2.items.findbyText("XXX").selected = true ; here XXX = first letter of the string and first dropdownlist must contains A-Z Alphabates . Thankx if it helps .

          P Offline
          P Offline
          pavanip
          wrote on last edited by
          #4

          Thank you so much for all your response. I solved my problem with this code foreach (ListItem item in ddlcont.Items) { if (item.Text.StartsWith(txtcont.Text, StringComparison.CurrentCultureIgnoreCase)) { ddlcont.SelectedIndex = ddlcont.Items.IndexOf(item); } }

          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