This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Data Source Using Methods on Entity Partial Classes

0 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 12 Oct 2010, 08:57 PM
I am using the [GridAction] attribute on a controller action to simplify paging and sorting.  I am setting the .Data GridModel property to an IQueryable<Entity>.  My entities are from Entity Framework.

I return a queryable from a repository in my domain, and then on the controller I project that result into a view model using linq's Select method.

The problem is, one of the properties I want to display on the grid is derived, so I'd like to assign a property on the GridModel to a custom method on my Entity partial class.  However, when I do this, I get a runtime error:

"Only initializers, entity members, and entity navigation properties are supported."

Is there any (simple) way around this?
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Share this question
or