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. population of data in dropdown list

population of data in dropdown list

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasehelpquestion
5 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.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    HI friendz, i have small problem...as u all helped me out in the past this time also expecting d same... well i have drop downlist in which i want to populate two coloumns of the table from Database "emp"(say the coloumns are firstname and lastname).what will be the respective code for it in c#.net ?

    J I 2 Replies Last reply
    0
    • B biswa47

      HI friendz, i have small problem...as u all helped me out in the past this time also expecting d same... well i have drop downlist in which i want to populate two coloumns of the table from Database "emp"(say the coloumns are firstname and lastname).what will be the respective code for it in c#.net ?

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      either you can concatenate the first and last Name at the stored proc level or you can do before binding it to the Dropdownlist (at the presentation level). try something like this while binding the data. LocalDataSet = SelectAll() ddl.DataValueField = "ID" ddl.DataTextField = "FirstName" + " " + "LastName" ddl.DataSource = LocalDataSet ddl.DataBind()

      - Regards -
         JON


      Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


      B 1 Reply Last reply
      0
      • B biswa47

        HI friendz, i have small problem...as u all helped me out in the past this time also expecting d same... well i have drop downlist in which i want to populate two coloumns of the table from Database "emp"(say the coloumns are firstname and lastname).what will be the respective code for it in c#.net ?

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        concatenate firstname and lastname in sql query like as select firstname+ '' + lastname as name from emp now you can bind DataTextField with name

        ddl.Datatextfield="Name"

        bEst Regard pAthan

        please don't forget to vote on the post that helped you.

        1 Reply Last reply
        0
        • J John ph

          either you can concatenate the first and last Name at the stored proc level or you can do before binding it to the Dropdownlist (at the presentation level). try something like this while binding the data. LocalDataSet = SelectAll() ddl.DataValueField = "ID" ddl.DataTextField = "FirstName" + " " + "LastName" ddl.DataSource = LocalDataSet ddl.DataBind()

          - Regards -
             JON


          Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


          B Offline
          B Offline
          biswa47
          wrote on last edited by
          #4

          Thanks

          J 1 Reply Last reply
          0
          • B biswa47

            Thanks

            J Offline
            J Offline
            John ph
            wrote on last edited by
            #5

            biswa47 wrote:

            Thanks

            Welcome.

            - Regards -
               JON


            Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


            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