JqGrid does not work in ASP.NET MVC2

I have a project in ASP.NET MVC1 using VB.NET controllers and JqGrid. It works fine with MVC1. After the project is migrated to ASP.NET MVC2, the grid is no longer populated. There seems to be some new restrictions on the returned Jsonresult in MVC2. How to solve it in VB.NET. The control function populating jqgrid looks something like this:

Function GetGridRecordset(ByVal qry As String) As JsonResult
  Dim result = New JsonResult()
  ...
  ...
  Return result
End Function

Does anyone have a solution?

+3
source share
3 answers

In MVC2: Dim result = New JsonResult () makes the default result. JsonRequestBehavior = JsonRequestBehavior.DenyGet, while in MVC1 this is not so. Answer:

Function GetGridRecordset(ByVal qry As String) As JsonResult 
  Dim result = New JsonResult()
  ...
  ...
  result.JsonRequestBehavior = JsonRequestBehavior.AllowGet
  Return result    
End Function

Now jqGrid works fine under MVC2 without changing the client code.

+1

I will need to see more code, but could it be before the changes to JsonResult in MVC 2? you may need to enable the verb GET by setting the JsonRequestBehavior property to JsonRequestBehavior.AllowGet

0
source

Source: https://habr.com/ru/post/1740654/


All Articles