0

Hi Guys

I have a following

var resultsMarks = from mItem in MItemList.ToList()
select new
{
ScienceGroup = mItem.ScienceGroup,
ArtsGroup = mItem.ArtsGroup,
CommerceGroup = mItem.CommerceGroup,
StudentID = mItem.StudentIDId
};

var detailtStudents = from student in SItemList.ToList()
select new
{
Name = student.Name,
Class = student.Class,
Section = student.Section,
Role = student.RoleNumber,
Science = from result in resultsMarks where result.StudentID == student.Id select result.ScienceGroup,
Arts = from result in resultsMarks where result.StudentID == student.Id select result.ArtsGroup,
Commerce = from result in resultsMarks where result.StudentID == student.Id select result.CommerceGroup

};

gvCollated.DataSource = detailtStudents;
gvCollated.DataBind();

Now, the problem is in the Grid I am getting only – Name, Class, Section, Role. But no more fields like Science, Arts, Commerce… This is happening because these are coming as Collection object, which can’t be displayed on the Grid in that way.

I want to select those specific value, not as collection.

Any help is highly appreciable Guys.

Thanks

(Visited 23 times, 1 visits today)
Add a Comment