protected void Page_Load(object sender, EventArgs e) { #region Linq 3 Lists using EntitiesDataContext StringBuilder writerToLiteral = new StringBuilder(); try { writerToLiteral.Append("<table>"); writerToLiteral.Append("<tr><td>Project Name</td><td>Employee Name</td><td>Employee Location</td><td>Employee ID</td></tr>"); using (EntitiesDataContext dc = new EntitiesDataContext("http://sp:1220/sites/cslteam")) //using (EntitiesDataContext dc = new EntitiesDataContext(SPContext.Current.Web.Url) { EntityList <ProjectsItem> Proj = dc.GetList <ProjectsItem>("Projects"); var q = from emp in Proj.ToList() //where emp.JoiningPeriod < 10 // orderby em.Title select new { emp.Title, //emp.EmployeeInProject, EmployeeName = emp.EmployeeInProject.Title, EmployeeLocation = emp.EmployeeInProject.CurrentLocation.Title, EmployeeID = emp.EmployeeInProject.EmployeeID, EmployeeState = emp.EmployeeInProject.CurrentLocation.Province, }; foreach (var qValue in q) { writerToLiteral.Append("<tr><td>"); writerToLiteral.Append(qValue.Title); writerToLiteral.Append("</td><td>"); writerToLiteral.Append(qValue.EmployeeName); writerToLiteral.Append("</td><td>"); writerToLiteral.Append(qValue.EmployeeLocation); writerToLiteral.Append("</td><td>"); writerToLiteral.Append(qValue.EmployeeID); writerToLiteral.Append("</td></tr>"); } } } catch (Exception x) { writerToLiteral.Append("<tr><td>"); writerToLiteral.Append(x.Message); writerToLiteral.Append("</td></tr>"); } finally { writerToLiteral.Append("</table>"); ListData.Text = writerToLiteral.ToString(); } #endregion Linq 2 Lists using EntitiesDataContext }