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

Public member 'ToDataSourceResult' on type 'ObjectQuery()' not found

0 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 08 Jun 2012, 03:14 PM

Hi,
I'm currently testing the kendo MVC Grid with Ajax Binding, and i have a getPedidosByColabId function in my repository, and a controller with GetListaGrid function that returns data to populate the grid and i'm getting this error "Public member 'ToDataSourceResult' on type 'ObjectQuery(Of PedidoDocumentacaoViewModel)' not found.". Any Help?

Public Function getPedidosByColabId(ByVal idColaborador As Integer)
        Dim listaPedidos = (From l In db.tblPEDDOC__tblPedidoDocumentacao
                            Where l.idColaborador = idColaborador
                            Select New PedidoDocumentacaoViewModel With {
                                .idPedidoDocumentacao = l.idPedidoDocumentacao,
                                .idEstadoPedidoDoc = l.idEstadoPedidoDoc,
                                .descEstadoPedidoDoc = l.tblPEDDOC__tblEstadoPedidoDoc.descEstadoPedidoDoc,
                                .idTipoPedidoDoc = l.idTipoPedidoDoc,
                                .descTipoPedidoDoc = l.tblPEDDOC__tblTipoPedidoDoc.descTipoPedidoDoc,
                                .data = l.data
                                })
  
        Return listaPedidos
    End Function


Public Function GetListaGrid(<DataSourceRequest()> request As DataSourceRequest) As ActionResult
            Dim idColaborador As Integer = 979
            Dim pRepository As New PedidosRepository
            Dim res = pRepository.getPedidosByColabId(idColaborador)
            Dim result As DataSourceResult = res.ToDataSourceResult(request)
            Return Json(result)
 End Function

Edit: Already solved it..

 

 

Dim result As DataSourceResult = New DataSourceResult With {.Data = res}

Sorry for the trouble

 


Thanks,
Ricardo Castro

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Ricardo
Top achievements
Rank 1
Share this question
or