I'm using the DatasourceUrl on a grid along with MVC to call a controller method that returns a datatable with data for the grid. The screen I am trying to create is basically a "search" screen, and the search filters are passed as json within the query string to the controller. We have the possibility for a lot of search filters being entered, and when the list gets too long, we get an error saying "Request filtering is configured on the Web server to deny the request because the query string is too long". My question is there another way to use DatasourceUrl or to call an MVC controller method without passing these values in the query string? Can we change the method to be an HttpPost so we can just pass the data, but not as part of the query string?
Right now the MVC controller method has the [GridDataSourceAction] attribute. If I add the [HttpPost] attribute it doesn't work any more (can't find the method).
Hello Ryan,
Thank you for contacting us.
You can call a controller with a simple ajax post request, and also can pass as many you want parameters. For example in button press you can call the controller like this:
Controller:
Looking forward to hearing from you.
We have tried something similar to this in the past but had issues with 1) paging functions on server side, and 2) Using DataTable with AsQueryable. Is there a way around these issues with what you suggested?
Hey Ryan,
I am still following your case.
It may take me a little bit of time to get back to this testing - you can close the case for now if you'd like and we can open it up again (or a new one) when I get back to it.
Hi,
If we use HTTP Post to get data for grid with separate ajax call , how we are going to handle following things
1) get last data source url with all query parameter (page,pageSize,$select,sort(xyz),filter etc)
2) How i will do remote pagaing , sorting & filtering ?
Thanks!
Manish
Okay Ryan,
I look forward to hearing from you.