This question is locked. New answers and comments are not allowed.
Mark Shortt
Top achievements
Rank 1
Mark Shortt
asked on 23 May 2011, 05:21 PM
Hi
Using the MVC grid I'm trying to set a bound column to a field in a sub table, but when I use the normal Linq expression I get the error
"Cannot convert lambda expression to type 'string' because it is not a delegate typeCode is
columns.Bound(o => o.WR_TakeAway_Dishes.DishName).Width(350).Sortable(false);
Is it possible to do this or will I need to create a separate class with the data from the sub table?
Using the MVC grid I'm trying to set a bound column to a field in a sub table, but when I use the normal Linq expression I get the error
"Cannot convert lambda expression to type 'string' because it is not a delegate typeCode is
columns.Bound(o => o.WR_TakeAway_Dishes.DishName).Width(350).Sortable(false);
Is it possible to do this or will I need to create a separate class with the data from the sub table?
4 Answers, 1 is accepted
0
Andrew
Top achievements
Rank 1
answered on 01 Jul 2011, 05:11 AM
met the same problem, why not have choosen the right overloading method:
public virtual GridBoundColumnBuilder<TModel> Bound<TValue>(Expression<Func<TModel, TValue>> expression);
public virtual GridBoundColumnBuilder<TModel> Bound<TValue>(Expression<Func<TModel, TValue>> expression);
0
Andrew
Top achievements
Rank 1
answered on 01 Jul 2011, 05:50 AM
solved.check your model class access modifier
0
Dan
Top achievements
Rank 1
answered on 23 Mar 2012, 07:19 PM
Can you be more specific? I just added one new column and now I get the error. If I remove the DISPLAY_ORDER column this code works:
.Columns(columns =>
{
columns.Bound(o => o.WorkOrderNumber).Title(ConfigurationManager.AppSettings["IdColumn"]);
columns.Bound(o => o.full_name).Title("Company");
columns.Bound(o => o.store_id).Title("Site Id");
columns.Bound(o => o.problem).Title("Problem");
columns.Bound(o => o.problem_type).Title("Category");
columns.Bound(o => o.DISPLAY_ORDER).Title("Category"); //THIS LINE IS ISSUE
});
}).Sortable().Filterable().Groupable().Footer(false).Resizable(
resizing => resizing.Columns(true)).Reorderable(reorder => reorder.Columns(true))
.Render();%>
.Columns(columns =>
{
columns.Bound(o => o.WorkOrderNumber).Title(ConfigurationManager.AppSettings["IdColumn"]);
columns.Bound(o => o.full_name).Title("Company");
columns.Bound(o => o.store_id).Title("Site Id");
columns.Bound(o => o.problem).Title("Problem");
columns.Bound(o => o.problem_type).Title("Category");
columns.Bound(o => o.DISPLAY_ORDER).Title("Category"); //THIS LINE IS ISSUE
});
}).Sortable().Filterable().Groupable().Footer(false).Resizable(
resizing => resizing.Columns(true)).Reorderable(reorder => reorder.Columns(true))
.Render();%>
0
Dadv
Top achievements
Rank 1
answered on 26 Mar 2012, 10:06 AM
Could you give us your model class to see all the types?
Regards,
Regards,