I'm working on implementing the jqgrid jquery plugin in my vb.net mvc 2 application. I've got it pulling in data (thanks to experts vbigham and CodeCruiser) from my ms sql database using JSON based on the tutorial here
. The next issue i need to deal with is getting sorting to work. Clicking on the column headers of my grid brings the "loading..." dialog up and it looks like it's trying to do something but then it stops and the data is in the original sort order.
The example I'm working from is in C# but I need to work in vb.net. I'm having trouble with the following line of code in the example:
Here is the C# version:
var questions = context.Questions
.OrderBy(sidx + " " + sord)
.Skip(pageIndex * pageSize)
and the converted version (I did this with an online C# to VB.NET convertor):
Dim students = context.Students_ts.OrderBy(sidx & " " & sord).Skip(pageIndex * pageSize).Take(pageSize)
The error in visual studio is as follows:
"Overload resolution failed because no accessible 'OrderBy' can be called with these arguments: Extension method 'Public Function OrderBy(Of TKey)(keySelector As System.Linq.Expressions.Expression(Of System.Func(Of Students_t, TKey)))
(and on and on ad nauseam) Specifying the data types explicitly might correct this error."
I found that if I change the OrderBy to "OrderBy(sidx& " " &sord)" (removing spaces) it reduces the error in Visual Studio to:
"Comma, ')', or valid expression continuation expected."
and when I mouse over the sidx& it shows "Dim sidx As string"
which I'm thinking is a good step in the right direction?
Obviously I don't know what the heck I'm doing but I'm trying to help move this project forward so I've taken on this piece. :)
Any ideas what I can do to resolve this? When I've been researching I see people making statements such as "I switched from JSON to XML and everything just worked". Is that a direction you'd recommend?
Any help you can provide, as always, will be greatly appreciated.