Hi,
I'm trying to bind columns from two different tables in to gridview using Linq To Sql
Here's the bind:
var q = (from o in mail.tblmails
join c in mail.tblstaffs on o.staffId equals c.id
select new { o, c });
return View(q);
and here is where I'm calling the bind in my View.
.Columns(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);
})
I'm getting an error
Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery1[<>f__AnonymousType0
6[System.Nullable1[System.DateTime],System.Nullable
1[System.Int32],System.String,System.Nullable1[System.DateTime],System.String,System.Int32]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1[ffs.Models.tblmail]'.
I have a feeling that the issue may have something to do with the line
< % Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>"%>
but I'm not sure what to do to fix it.
I'm using the telerik grid extension.
Any help would be great, thanks.