• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to auto select the value in drop down list

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello sir
i have ondrop down list and i want to retrieve some value from database and then want that value to be selected in that drop down list .

plz tell me that how to do that because it is urgent...

thank you
gaurav
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add the selected atttribute in the option tag when you are creating the drop down on the server

or if you are not creating it dynamically you can do it with JavaScript if you know where it is on the list.

document.FormName.elementName.selectedIndex = 2;

If you do not know where it is, you need to loop through the options until it matches then select it.

Eric
reply
    Bookmark Topic Watch Topic
  • New Topic