How to read List Items ?
-
Hello All, I am using ASP.NET 3.5 (C#) with LINQ. I am getting 8 elements in the List but I dont know how to read each element.
List yp = _datacontext.New_Patients.Where(a =>;a.StageTimeLineType.StageID.Equals(0)).OrderBy(a => a.Year).ThenBy(a => a.PeriodIdentifier).Select(a => new YearPeriods(a.Year, a.PeriodIdentifier)).ToList();
here yp returns 8 rows ... Data will be something like this: PeriodIdentifier | Year 13 | 2007 14 | 2007 15 | 2007 16 | 2007 13 | 2008 14 | 2008 15 | 2008 16 | 2008 I have take every element and generate columns runtime for GridView. Column Names will be something like Q1 07, Q2 07, Q3 07, Q4 07, Q1 08, Q2 08, Q3 08 and Q4 08 Please help me ... Thanks in advance ....
-
Hello All, I am using ASP.NET 3.5 (C#) with LINQ. I am getting 8 elements in the List but I dont know how to read each element.
List yp = _datacontext.New_Patients.Where(a =>;a.StageTimeLineType.StageID.Equals(0)).OrderBy(a => a.Year).ThenBy(a => a.PeriodIdentifier).Select(a => new YearPeriods(a.Year, a.PeriodIdentifier)).ToList();
here yp returns 8 rows ... Data will be something like this: PeriodIdentifier | Year 13 | 2007 14 | 2007 15 | 2007 16 | 2007 13 | 2008 14 | 2008 15 | 2008 16 | 2008 I have take every element and generate columns runtime for GridView. Column Names will be something like Q1 07, Q2 07, Q3 07, Q4 07, Q1 08, Q2 08, Q3 08 and Q4 08 Please help me ... Thanks in advance ....
I'm new on LINQ, but maybe you should use something like this :
List yp = from q in _datacontext
where ( your condition)
orderby q.Year ascending
select new
{
q.Year,
q.PeriodIdentifier
};