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. Adding Entries to A DropDown ListBox

Adding Entries to A DropDown ListBox

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdatabase
2 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.
  • P Offline
    P Offline
    Pradhip
    wrote on last edited by
    #1

    Hi All: This is an ASP.NET ,Windows,VB.NET application that i am talking about.. I have a peculiar Challenge and need a work around.There is a form that my application uses, which has a drop down list being populated at run time. Apart from the data being populated i want the dropdownlist to have the option "Select one by clicking" as the default selected option in this listbox.I have managed to do it by the commands **txt_listbox.items.add** and then selected the option using **txt_listbox.items.findbytext("---").selected=true** But then the challenge is this option though gets selected is the last item on my dropdown listbox after all the data from the database..But i want it to be the first..How do i do that. If i try adding this entry and then populating from the database the database entries wipe out this entry. I can Instead of using a datasource simply get the dataset and then do a iteration though the values in the dataset and do the add items command.But then my dropdown list box displays one value(ie CustomerName) and binds to another value in the dataset (ie CustomerID).I will lose this functionality when i iterate.So right now i need somE work around for this. Any help is greatly appreciated.. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??

    T 1 Reply Last reply
    0
    • P Pradhip

      Hi All: This is an ASP.NET ,Windows,VB.NET application that i am talking about.. I have a peculiar Challenge and need a work around.There is a form that my application uses, which has a drop down list being populated at run time. Apart from the data being populated i want the dropdownlist to have the option "Select one by clicking" as the default selected option in this listbox.I have managed to do it by the commands **txt_listbox.items.add** and then selected the option using **txt_listbox.items.findbytext("---").selected=true** But then the challenge is this option though gets selected is the last item on my dropdown listbox after all the data from the database..But i want it to be the first..How do i do that. If i try adding this entry and then populating from the database the database entries wipe out this entry. I can Instead of using a datasource simply get the dataset and then do a iteration though the values in the dataset and do the add items command.But then my dropdown list box displays one value(ie CustomerName) and binds to another value in the dataset (ie CustomerID).I will lose this functionality when i iterate.So right now i need somE work around for this. Any help is greatly appreciated.. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??

      T Offline
      T Offline
      Tom Archer
      wrote on last edited by
      #2

      Pradhip wrote: But i want it to be the first..How do i do that. Use the Insert method passing 0 as the index. Cheers, Tom Archer Author - Inside C#, Visual C++.NET Bible

      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