I have a list of strings - EmployeeNames
I have a list of list -
- >
So basically i want to populate a Grid in such a way that each row is assigned a name, as well as all the shifts that are in the list of shifts that relate to that specific line.
E.g.
Employee1 --- List of shifts for index 1 --- list[1][allshifts]
Employee2 ---- list[2][allshifts]
I want all this to be data bound.
Essentially it doesnt matter what im doing with the data....i just want to know how to logically do this.
The list of shifts should be a user control together with the name.
Thanks in advance.
Urema.
Kirtan PatelPosted Aug 17, 2009, 12:47 PM
Here is Logic What you Trying to Implement :)
dont Forget to mark "Do you like answer" please it will give me some credit :)
List<List<string>> ListList = new List<List<string>>();
List<string> EmployeeList = new List<string>();
int i=0;
//Add List to ListList
List<string> List = new List<string>();
List.Add("Item1");
List.Add("Item2");
List.Add("Item2");
ListList.Add(List);
//Add Another List to List List
List<string> List2 = new List<string>();
List2.Add("Item12");
List2.Add("Item22");
List2.Add("Item23");
ListList.Add(List2);
EmployeeList.Add("Emp1");
EmployeeList.Add("Emp2");
dataGridView1.Columns.Add(new DataGridViewColumn(new DataGridViewTextBoxCell()));
dataGridView1.Columns.Add(new DataGridViewColumn(new DataGridViewTextBoxCell()));
foreach (string emp in EmployeeList)
{
dataGridView1.Rows.Add(new DataGridViewRow());
dataGridView1.Rows[i].Cells[0].Value = emp.ToString();
List<string> x = ListList[i];
foreach (string s in x)
{
dataGridView1.Rows[i].Cells[1].Value += s+" ";
}
i++;
}
personPosted Aug 18, 2009, 4:03 AM
Yea that does the job very specifically, now I shall extend this so that all values get updated automatically within my code.
Thanks.
Urema.
personPosted Aug 17, 2009, 11:17 AM
Thanks
Kirtan PatelPosted Aug 17, 2009, 9:26 AM
personPosted Aug 17, 2009, 9:23 AM
Kirtan PatelPosted Aug 17, 2009, 8:23 AM