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. Multiple value under a single dropdownlist item

Multiple value under a single dropdownlist item

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasesql-serversysadminquestion
4 Posts 3 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.
  • C Offline
    C Offline
    cocoonwls
    wrote on last edited by
    #1

    Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls

    A N 2 Replies Last reply
    0
    • C cocoonwls

      Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      No. Actually there must be only one Value for each Dropdown option. Also the DataValueField will be unique. If you want to create such thing, you need to use your own dropdownlist. :(

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      1 Reply Last reply
      0
      • C cocoonwls

        Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls

        N Offline
        N Offline
        Nisha Agrawal
        wrote on last edited by
        #3

        you can do this by adding a custom data field to the data source having value as concatenation of the two or more fields that you wanna use as DataValueField. Then again process/manipulate this value while retrieving the SelectedValue of the dropdown list.

        C 1 Reply Last reply
        0
        • N Nisha Agrawal

          you can do this by adding a custom data field to the data source having value as concatenation of the two or more fields that you wanna use as DataValueField. Then again process/manipulate this value while retrieving the SelectedValue of the dropdown list.

          C Offline
          C Offline
          cocoonwls
          wrote on last edited by
          #4

          Hi, Thanks for both of your kindly help. I have found a solution. I am using concatenation in query and put in the DataValueField.Then retrive it by ddl.selectedValue.split() to get the value in string array. Here is the example:

          Query = Select (fieldA + ',' + fieldB) as Result From Table1

          Set DataValueField to Result.
          Then, set String[] aResult = ddl.selectedValue.split(',')
          Finally get value from aResult[i].

          Thank you :laugh: regards cocoonwls

          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