Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

LINQ to SP Problem

$
0
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


Preetam


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>