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. How to bind all the columns in a data table to dropdownl list?

How to bind all the columns in a data table to dropdownl list?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorialquestionannouncement
9 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
    chakran
    wrote on last edited by
    #1

    Hi, Is it possible to bind all the columns in a data table to a dropdownlist? ex, I have the below table, I want to bind all the columns except ProductID column to a dropdownlist and when user select product from the list   I need to get the productID.Can any one suggest me.. If not possible in dropdown is there any alternative method to meet my requirement? am using vs2008 asp.net and C# ProductID   Product Name     Version     Platform 111           Madeira           2.0         windows 222           Amazon              1.1         windows 333           Madeira3           2.1            Lynux

    J 1 Reply Last reply
    0
    • C chakran

      Hi, Is it possible to bind all the columns in a data table to a dropdownlist? ex, I have the below table, I want to bind all the columns except ProductID column to a dropdownlist and when user select product from the list   I need to get the productID.Can any one suggest me.. If not possible in dropdown is there any alternative method to meet my requirement? am using vs2008 asp.net and C# ProductID   Product Name     Version     Platform 111           Madeira           2.0         windows 222           Amazon              1.1         windows 333           Madeira3           2.1            Lynux

      J Offline
      J Offline
      jinovv
      wrote on last edited by
      #2

      Loop the datatable and Append All the values expect productId into string .Use this string as DataTextField anf ProductId as DataValueField

      C 1 Reply Last reply
      0
      • J jinovv

        Loop the datatable and Append All the values expect productId into string .Use this string as DataTextField anf ProductId as DataValueField

        C Offline
        C Offline
        chakran
        wrote on last edited by
        #3

        thanks for your suggestion. I have hundreds of products in the table. Is there any possibility to have scroll bar in the dropdonwnlist.

        J 1 Reply Last reply
        0
        • C chakran

          thanks for your suggestion. I have hundreds of products in the table. Is there any possibility to have scroll bar in the dropdonwnlist.

          J Offline
          J Offline
          jinovv
          wrote on last edited by
          #4

          When you click on the arow in the drop down list , it will be shows a list of items with scroll bar. am i right?

          C 1 Reply Last reply
          0
          • J jinovv

            When you click on the arow in the drop down list , it will be shows a list of items with scroll bar. am i right?

            C Offline
            C Offline
            chakran
            wrote on last edited by
            #5

            correct...

            J 1 Reply Last reply
            0
            • C chakran

              correct...

              J Offline
              J Offline
              jinovv
              wrote on last edited by
              #6

              Then why should you need a scroll bar in dropdownlist?

              C 1 Reply Last reply
              0
              • J jinovv

                Then why should you need a scroll bar in dropdownlist?

                C Offline
                C Offline
                chakran
                wrote on last edited by
                #7

                when the dropdownlist gets too many items in it the user cannot select the bottom ones (the bottom goes below the screen area).   How do i put the scrollbar in the dropdownlist?

                C 1 Reply Last reply
                0
                • C chakran

                  when the dropdownlist gets too many items in it the user cannot select the bottom ones (the bottom goes below the screen area).   How do i put the scrollbar in the dropdownlist?

                  C Offline
                  C Offline
                  chakran
                  wrote on last edited by
                  #8

                  scroll bar is coming automatically when items are more...

                  S 1 Reply Last reply
                  0
                  • C chakran

                    scroll bar is coming automatically when items are more...

                    S Offline
                    S Offline
                    sekannak
                    wrote on last edited by
                    #9

                    Hi, We can put dropdownlist into a panel

                    kannak

                    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