1

I am using the MVC Kendo Grid This is my Read method:

 @(Html.Kendo().Grid<Model>()
                       .Name("Grid")
                       .Columns(columns =>
                        {
                        }
 .DataSource(dataSource => dataSource
 .Ajax()
 .Read(read => read.Action("MyAction", "MyController", new { ids = 
     Model.SelectedIds }))
      )
  )

Model.SelectedIds is a comma separated string of ids, which I split in the controller and fetch records for the Ids. This works fine if Model.SelectedIds is a small string However, when it is a huge string with many ids (3000 for example), then the Action is never called.

Wherever I am sending Json data, I have already set the Json limit to max in the web.config file. Here, I don't think it should affect, since this is not a Json request, correct?

Please help me fix this.

The Action is as below:

public ActionResult MyAction(DataSourceRequest request, string ids){
}
tereško
  • 58,060
  • 25
  • 98
  • 150

2 Answers2

0

I bet you need to check the max request length and if your using url then check the max url length. Also, there is a config element that can control the json length.

  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="99999999" />                                          
      </webServices>
    </scripting>
  </system.web.extensions>  
Community
  • 1
  • 1
Ross Bush
  • 14,648
  • 2
  • 32
  • 55
0

I fixed this by sending the data as an object instead of a param

.Read(read => read.Action("MyAction", "MyController").Data
("postData"))

JavaScript code

function postData() {
    return { ids: $("#SelectedIds").val() };
}