Multiple entries per row in a datagrid
-
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
-
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
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
-
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
-
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?:)
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
-
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
-
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
-
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?
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
-
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
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?
-
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
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