0
我有以下代碼:與外鍵綁定實體DataList控件
var devices = from d in ctx.Devices.Include("DeviceGroups")
where d.DeviceEnabled == true
select d;
dlTerminals.DataSource = devices;
在前端我做到以下幾點:
<asp:DataList ID="dlTerminals" runat="server" DataKeyField="DeviceId" GridLines="None" RepeatColumns="2" RepeatDirection="Horizontal" Width="100%">
<ItemTemplate>
<%# Eval("DeviceGroups.GroupName")%>
</ItemTemplate>
</asp:DataList>
,但我得到了以下錯誤:
does not contain a property with the name 'GroupName'.
我不確定。我認爲這是EF的問題:(不是因爲你的代碼。 – anishMarokey 2009-10-19 10:38:53