1
votes

I have the next

@(Html.Kendo().Grid<Corporativo.Model.SolicitudProductoVM>()
                    .Name("SolicitudesProducto")
                    .Columns(columns =>
                    {
                        columns.Bound(e => e.Consecutivo).Width(20).Title("CÓDIGO");
                        columns.Bound(e => e.Desc_Cliente).Width(80).Groupable(false).Title("CLIENTE");
                        columns.Bound(e => e.Fecha).Width(40).Groupable(false).Title("FECHA");
                        columns.Bound(e => e.Imp_Total).Width(40).Groupable(false).Title("IMP. TOTAL");
                    })                    
                    .Filterable()
                    .Pageable()
                    .Scrollable()
                    .DataSource(dataSource => dataSource
                        .Ajax()                        
                        .Read(read => read.Action("GetAllSolicitudesJSON", "CrmProductRequest", null))
                    )
                )

with the next error...

Cannot find a public property of primitive type to sort by.

Ideas???

1
Did you add this: Sortable? - Rick S
No, with Sortable() and without Sortable() same error... - dennitorf
Maybe your model class properties need to be public? - CSharper

1 Answers

0
votes

I have this error with Kendo UI and I did not have sorting used in my view. For me it I found an issue with the view model, I had used a view model to stop an different issue with EF objects causing circular errors. If this is still an issue and you use view models try setting the attributes with full getter and setters.

I had my view model properties declared like this: *

public int OrderID;

I and I changed them to this to get Kendo .ToDataSource() to work:

public int OrderID
{
    get;
    set;
}

*Other syntax issues with these properties could also cause this error.

This is the article that explains how to get rid of circular references that indirectly helped me come to this conclusion. I hope that this may still be helpful to someone who stumbled onto this question like I did.