How can I make a relation between two list an show them in a grid with master detail. I wrote this but it didn't work:
var students = (from s in new XPQuery<StudentOfClass>(session)
join e in new XPQuery<Exam>(session) on s equals e.StudentOfClass
select new
{
LastName = s.Student.LastName,
Score = e.Score,
Grade = e.GradeTitle,
Class = s.Class,
}).ToList();
var classes = (from c in new XPQuery<Class>(session)
select new
{
Class = c,
StudentsOfClass = students.Where(x=>x.Class == c),
}).ToList();
gcClass.DataSource = classes;
and also I've added a level to my grid and named it "StudentsOfClass"
I've got error for where clause.
write the code like
var classes = from c in new XPQuery<Class>(session)
select new Class
{
Class = c,
Student = students,
};
and create the grid coloumn same as all the coloumn of the list
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.