我试图从两个不同的表列绑定中使用LINQ的GridView到SQL使用LINQ to SQL
这里选择多个表的绑定:
变种Q =(邻在mail.tblmails
加入c mail.tblstaffs on o.staffId等于c.id
选择新{o,c});
return查看(q);
这里是我调用我的视图中的绑定。
.Columns(列=> {
columns.Bound(o => o.dateAdded).Format("{0:MM/dd/yyyy}").Width(80);
columns.Bound(o => o.companyId);
//columns.Bound(c => c.staffId);
columns.Bound(o => o.subject);
columns.Bound(o => o.dateArchived);
})
我发现了一个错误
异常详细信息:System.InvalidOperationException:传递到词典中的模型项的类型为“System.Data .Linq.DataQuery 1[<>f__AnonymousType0
6 [System.Nullable 1[System.DateTime],System.Nullable
1 [System.Int32],System.String,System.Nullable 1[System.DateTime],System.String,System.Int32]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1 [ffs.Models.tblmail]”。
我有一种感觉,ISS可能与该行有关
<%Page Title =“”Language =“C#”MasterPageFile =“〜/ Views/Shared/Site.Master”Inherits =“System.Web.Mvc.ViewPage>” %>
但我不确定如何解决它。
我正在使用telerik电网扩展。
任何帮助将是伟大的,谢谢。