Pending Review
Last Updated: 12 Jan 2017 10:44 by Ian
Created on: 12 Jan 2017 10:44
Category: UI for ASP.NET MVC
Type: Feature Request
Provide error msg to MVC grid (or ToDataSourceResult) if invalid page is requested in paged data, rather than silently returning no data
If you change the dataSource to a grid (for example by changing the filter conditions) so that less data is returned, you will not be warned if the current page is no longer valid. No error is reported and no data is returned and you won't have a clue why.

Try this to replicate:

Make a paged grid plus a couple of datepickers to filter the grid data by date range. Add a button to make the new filter dates effective.

Write a new MVC controller method to populate the data, using the ToDataSourceResult extension method e.g. "return Json(obj.ToDataSourceResult(request));" to return data.

Open a sizeable dataset in the grid (many pages) and go to the last page.

Change the filter conditions to be much more restrictive. Click the button to make them effective.

Watch as the grid displays no data, the code reports no error and stepping into your controller confirms that the method is returning data.

Confusing huh? An error or warning would make this much clearer.