Hi!
I tried to migrate an ASP.Net MVC project from 2015.2 to 2016.1.I initialize my controls by the MVC wrapper, because its very easy.I don't set a DataSource or DataSourceUrl, because in the most cases i set them dynamically in JavaScript afterwards (for example i add a url-get-parameter in reference to an other object).
This behaviour is no more possible in 2016.1. I always get an exception with undefined or null property "Records".
You can test this by your sample project. Just remove the line with "DataSourceUrl" in "Views\Grid\aspnet-mvc-helper.cshtml" and call the page in your browser.In 2015.2 you get an empty Grid, in 2016.1 you'll get an exception.
It would be great if you can give me a workaround to use them.I also would like to see an alternative for sending a parameter in the databind-method to the controller by adding a get-parameter to the DataSourceUrl.
Hello Michael,
You can set .ResponseDataKey(null) if you don't specify data source initially.
But then afterwards just before applying the data to the grid you need to specify its responseDataKey. (By default the MVC wrapper set this value to be "Records")
For example:
$("#Grid1").igGrid("option", "responseDataKey", "Records");
$("#Grid1").igGrid("option", "dataSource", "http://localhost:4616/iggrid/getdata");
Solution solved the problem. Thx for help.
However i would appreciate the old behaviour like the versions before.
Everytime setting the "responseDataKey" is really annoying.