Hi,
I'm very new to using Linq-to-SQL, that's why I'm asking this question. I've searched the site, but can't seem to figure out how to do this.
My problem is:
I have a database mapped with LINQ to SQL:
Table 1: PersonalTasks
TaskId
Header
[Content]
IsDone
CreatedDate
Table 2: Comments
CommentId
TaskId
UserId
Comment
CreatedDate
I have a repeater:
<asp:Repeater ID="PersonalTaskRepeater" runat="server">
<ItemTemplate>
<%#Eval("Header") %>
<%# Eval("Content") %>
Task done: <asp:CheckBox ID="IsDoneCheckBox" runat="server" Checked='<%#Eval("IsDone") %>' /><img src="Images/tick-circle.png" />
Here i want to access the comment table, with the comments related to the taskID
</ItemTemplate>
</asp:Repeater>
I've tried using: <%#Eval("Comment.Comment1")%>
but that throws this error:
DataBinding: 'System.Data.Linq.EntitySet`1[[Assistr.Models.Comment, Assistr, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not contain a property with the name 'Comment'.
My code-behind:
var tasks = db.PersonalTasks.OrderBy(x => x.IsDone).ToList();
PersonalTaskRepeater.DataSource = tasks;
PersonalTaskRepeater.DataBind();
Do I need to use 2 repeaters to do what I want to do or? :)
Thanks in advance :)
//Mads