Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i use this code for fill datagrid (EF)
i use many to many relashion...
but when one kelas have several teacher, datagrid show several row of class for any teacher
i want to show any class with teachers in one row wit comma separate for teacher
can any one help me?

C#
var q = from p1 in db.tbl_dore
                    join p2 in db.tbl_dore_teacher on p1.dore_id equals p2.fk_dore into list1
                    from l1 in list1.DefaultIfEmpty()
                    join p3 in db.tbl_teacher on l1.fk_teacher equals p3.teacher_id into list2
                    from l2 in list2.DefaultIfEmpty()
                    select new {p1.dore_id, p1.dore_code,p1.dore_startdate,l2.teacher_fullname} ;
           dgv_dore.DataSource = q.ToList();


kelas teacher
1 A
1 B
2 C

i want to ...
kelas teacher
1 A,B
2 C

thanks
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900