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. General Programming
  3. C#
  4. Multiple entries per row in a datagrid

Multiple entries per row in a datagrid

Scheduled Pinned Locked Moved C#
databasehelpquestion
9 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.
  • F Offline
    F Offline
    falles01
    wrote on last edited by
    #1

    Hi there. I have had a search on the net but can't find anything that matches what i need. I have a datagrid which I have displaying entries from a dataset. What thw problem is, is that the same person displays multiple times depending on how many skills they have. EG Tom Hanks Skill1 Tom Hanks Skill2 bla bla I want the skills to display in one row. EG Tom Hanks Skill1, Skill2, Skill3 etc. I found something on the code project but it doesn't seem relevant. I think I have my sql select statement correct but I'm thinking I'll need some sort of loop? Thank you

    V 1 Reply Last reply
    0
    • F falles01

      Hi there. I have had a search on the net but can't find anything that matches what i need. I have a datagrid which I have displaying entries from a dataset. What thw problem is, is that the same person displays multiple times depending on how many skills they have. EG Tom Hanks Skill1 Tom Hanks Skill2 bla bla I want the skills to display in one row. EG Tom Hanks Skill1, Skill2, Skill3 etc. I found something on the code project but it doesn't seem relevant. I think I have my sql select statement correct but I'm thinking I'll need some sort of loop? Thank you

      V Offline
      V Offline
      Vikram A Punathambekar
      wrote on last edited by
      #2

      1. Concatenate all skills for a person into a single string, and display that as a Skills column. Eg: Neo | Male | 22 | Kung fu, Jujitsu 2. If you know a person can have only N skills, create N extra columns called Skill1, Skill2... SkillN and add them to your grid. 3. You can display the skills in a nested grid.

      Cheers, विक्रम


      And sleep will come, it comes to us all And some will fade and some will fall

      F 1 Reply Last reply
      0
      • V Vikram A Punathambekar

        1. Concatenate all skills for a person into a single string, and display that as a Skills column. Eg: Neo | Male | 22 | Kung fu, Jujitsu 2. If you know a person can have only N skills, create N extra columns called Skill1, Skill2... SkillN and add them to your grid. 3. You can display the skills in a nested grid.

        Cheers, विक्रम


        And sleep will come, it comes to us all And some will fade and some will fall

        F Offline
        F Offline
        falles01
        wrote on last edited by
        #3

        Thanks. That could work but they can have up to 20 skills. Is there a way to get maybe a drop down box with results or all results in one field?:)

        V 1 Reply Last reply
        0
        • F falles01

          Thanks. That could work but they can have up to 20 skills. Is there a way to get maybe a drop down box with results or all results in one field?:)

          V Offline
          V Offline
          Vikram A Punathambekar
          wrote on last edited by
          #4

          falles01 wrote:

          Is there a way to get maybe a drop down box with results or all results in one field?

          Umm, I said you can concatenate all the skill values into a single field and display them in a Skill column. DDB - not sure (I'm not much of a winforms guy) but you can google for it. If you don't mind paying, Infragistics has a grid that can display grids within a grid, which may be to your liking. Whereabouts in Australia are you? I have a mate in Brissy.

          Cheers, विक्रम


          And sleep will come, it comes to us all And some will fade and some will fall

          F 2 Replies Last reply
          0
          • V Vikram A Punathambekar

            falles01 wrote:

            Is there a way to get maybe a drop down box with results or all results in one field?

            Umm, I said you can concatenate all the skill values into a single field and display them in a Skill column. DDB - not sure (I'm not much of a winforms guy) but you can google for it. If you don't mind paying, Infragistics has a grid that can display grids within a grid, which may be to your liking. Whereabouts in Australia are you? I have a mate in Brissy.

            Cheers, विक्रम


            And sleep will come, it comes to us all And some will fade and some will fall

            F Offline
            F Offline
            falles01
            wrote on last edited by
            #5

            Adelaide. Not really close to brisbane at all. The opposite side of Australia actually.

            1 Reply Last reply
            0
            • V Vikram A Punathambekar

              falles01 wrote:

              Is there a way to get maybe a drop down box with results or all results in one field?

              Umm, I said you can concatenate all the skill values into a single field and display them in a Skill column. DDB - not sure (I'm not much of a winforms guy) but you can google for it. If you don't mind paying, Infragistics has a grid that can display grids within a grid, which may be to your liking. Whereabouts in Australia are you? I have a mate in Brissy.

              Cheers, विक्रम


              And sleep will come, it comes to us all And some will fade and some will fall

              F Offline
              F Offline
              falles01
              wrote on last edited by
              #6

              You mean concatenate the skills into one field using sql? How do you do that? My sql statement gets all the correct skills but how do you get it into one field? wouldn't I need some c# code for that?

              V 1 Reply Last reply
              0
              • F falles01

                You mean concatenate the skills into one field using sql? How do you do that? My sql statement gets all the correct skills but how do you get it into one field? wouldn't I need some c# code for that?

                V Offline
                V Offline
                Vikram A Punathambekar
                wrote on last edited by
                #7

                Without seeing your code, there's no way I can tell you how to do it. Perhaps you should google for this stuff, it's fairly simple. Tip: You need to add a new DataColumn that will contain the skills to your DataTable.

                Cheers, विक्रम


                And sleep will come, it comes to us all And some will fade and some will fall

                F 2 Replies Last reply
                0
                • V Vikram A Punathambekar

                  Without seeing your code, there's no way I can tell you how to do it. Perhaps you should google for this stuff, it's fairly simple. Tip: You need to add a new DataColumn that will contain the skills to your DataTable.

                  Cheers, विक्रम


                  And sleep will come, it comes to us all And some will fade and some will fall

                  F Offline
                  F Offline
                  falles01
                  wrote on last edited by
                  #8

                  Thanks. I never ask a question on a forum unless I hae thoroughly searched google and haven't found anything or I don't know what I'm searching for, hence the question. In regards to your tip, I already have a skills column which works fine but just displays each new skills in a new row. Do you mean create another column for skills?

                  1 Reply Last reply
                  0
                  • V Vikram A Punathambekar

                    Without seeing your code, there's no way I can tell you how to do it. Perhaps you should google for this stuff, it's fairly simple. Tip: You need to add a new DataColumn that will contain the skills to your DataTable.

                    Cheers, विक्रम


                    And sleep will come, it comes to us all And some will fade and some will fall

                    F Offline
                    F Offline
                    falles01
                    wrote on last edited by
                    #9

                    Sorry but I'll give you my code so oyu can see what I currently do. string sql = "bla bla "; SqlDataAdapter myCommand = new SqlDataAdapter(sql, myConnection); //Create dataset and fill it with employee data DataSet ds = new DataSet(); myCommand.Fill(ds); //bind employee data to datagrid DataView Source = ds.Tables[0].DefaultView; Source.Sort = sortField; dgSearchResults.DataSource = ds.Tables[0]; After this would I then create a new datacolumn? I found this link. Is it something like that? and then I have to concatenate string somehow? :) http://msdn2.microsoft.com/en-US/library/system.data.datacolumn.aspx">http://msdn2.microsoft.com/en-US/library/system.data.datacolumn.aspx

                    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