Hey everyone,
I am having Entity Framework Serialization Circular reference problems when attempting to bind to my Kendo UI grid. I found the documentation about how to deal with it here:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting
Which led me to here:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-avoid-circular-reference-exceptions?
I have now implemented that change on my controller and am passing an anonymous type collection to my view. However now at runtime, when I try to look at my page, it immediately throws an Exception stating
"CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type"
Below is a snippet from my grid and controller. Property3 is the one it is complaining about, which is the one I am using to bypass the object in my anonymous type collection.
The JSON is built up like the following:
var collection = result.ToDataSourceResult(request, c => new
{
Property1 = c.Property1
Property2 = c.Property2
Property3 = c.EntityFrameworkObject.Property3
Property4 = c.Property4
});
return Json(collection, JsonRequestBehavior.AllowGet);
@(Html.Kendo().Grid<My.Namespace.To.My.EntityObject>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Property1);
columns.Bound(p => p.Property2).Width(100);
columns.Bound(p => p.Property3).Width(100);
columns.Bound(p => p.Property4.Width(100);
columns.Command(command => { command.Edit(); }).Width(160);
})
As far as I can tell, this follows the example given. Why am I getting this "CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type" error and what do I need to do to get rid of it?
The only other thing I can think of is to remove the "My.Namespace.To.My.EntityObject, because there is no "Property3" on that object, however the compiler complains if I don't specify a type in the <> .
I am at a loss of how to move forward here.
I am having Entity Framework Serialization Circular reference problems when attempting to bind to my Kendo UI grid. I found the documentation about how to deal with it here:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting
Which led me to here:
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-avoid-circular-reference-exceptions?
I have now implemented that change on my controller and am passing an anonymous type collection to my view. However now at runtime, when I try to look at my page, it immediately throws an Exception stating
"CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type"
Below is a snippet from my grid and controller. Property3 is the one it is complaining about, which is the one I am using to bypass the object in my anonymous type collection.
The JSON is built up like the following:
var collection = result.ToDataSourceResult(request, c => new
{
Property1 = c.Property1
Property2 = c.Property2
Property3 = c.EntityFrameworkObject.Property3
Property4 = c.Property4
});
return Json(collection, JsonRequestBehavior.AllowGet);
@(Html.Kendo().Grid<My.Namespace.To.My.EntityObject>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Property1);
columns.Bound(p => p.Property2).Width(100);
columns.Bound(p => p.Property3).Width(100);
columns.Bound(p => p.Property4.Width(100);
columns.Command(command => { command.Edit(); }).Width(160);
})
As far as I can tell, this follows the example given. Why am I getting this "CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type" error and what do I need to do to get rid of it?
The only other thing I can think of is to remove the "My.Namespace.To.My.EntityObject, because there is no "Property3" on that object, however the compiler complains if I don't specify a type in the <> .
I am at a loss of how to move forward here.