Fixed it - it was simple - of course:
I changed this line:
.DataKeys(k => k.DataKeys.Add(t => t.TravelerID))
to this:
.DataKeys(k => k.Add(t => t.TravelerID))
and now it works.
Вопрос
I have the following view with a Telerik MVC Grid:
@model IEnumerable<QuoteManagement.Data.Traveler>
@(Html.Telerik().Grid(Model)
.Name("Travelers")
.DataKeys(k => k.DataKeys.Add(t => t.TravelerID)) //<-- error on this line
.DataBinding(db => db.Server()
.Delete("Delete","Traveler")
.Update("Edit","Traveler")
)
.Columns(c =>
{
c.Command(cmd => {cmd.Edit(); cmd.Delete(); });
c.Template(col => String.Format("{0} {1}", col.FirstName, col.LastName)).Title("Name");
c.Bound(col => col.Birthdate);
c.Bound(col => col.Notes);
}))
I am getting the following compilation error: Cannot convert lambda expression to type 'Telerik.Web.Mvc.UI.IGridDataKey' because it is not a delegate type
QuoteManagement.Data.Traveler is an EF Entity type.
Решение
Fixed it - it was simple - of course:
I changed this line:
.DataKeys(k => k.DataKeys.Add(t => t.TravelerID))
to this:
.DataKeys(k => k.Add(t => t.TravelerID))
and now it works.