c# - ObjectDataSource with Composite Lists -
I have a list that includes student notifications
lsStudents = context.GetTable & Lt; Students & gt; (). Where (P = & gt; p.M_Id.Equals (1)). ToList ();
And I have another student that includes student lesson
lsMarks = context.GetTable & lt; Mark & gt; (). Where (p = & gt; p.m_StudentId .Equals (1)) ToList () .;
I want to pair these lists with one repeater at an object data source.
& lt; Asp: repeater id = "rpt" runat = "server" & gt; & Lt; ItemTemplate & gt; & Lt; Div & gt; & Lt;% Databinder.Eval (container.detime, "M_StudenName")% & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt;% Databinder.Eval (container.detime, "m_mark")%> & Lt; / Div & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; You can join the two on the ID field and select the fields of interest.
A new, anonymous type.
var lsStudentWithMarks = context.GetTable & lt; Students & gt; (). Where (P = & gt; PM_ID.QWLZ (1)) .Join (context.GetTable (). Where (P = & gt; PM student ID.Elloles (1), (O, I) => OM_ID == i.m_StudentId, (O, I) => New {OMM / StudentName}, I.m_Mark}}. (J = & New; New {J.M_StudentName, j.M_Mark}). Ollist ();
Comments
Post a Comment