We are using WebDataGrid from NetAdvantage 2011.2 for Asp.Net –bundle and embedded the custom pager described on page:
http://www.infragistics.com/products/aspnet/sample/data-grid/paging-custom-pager-template
The custom pager works fine when update/edit behavior is disabled. However, when we enable edit behavior (batch mode!), editing works only on first page. If the user e.g. clicks Next-button and tries to edit something on the second page, saving fails and the grid freezes. No error is displayed, but in JavaScript error console we see an error message:
SCRIPT5022: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
This tells us very little, but by debugging we get the original error message from WebDataGrid: “Requested record cannot be found by key”. Debugging also revealed that when saving, finding the right page somehow fails. Most probably the grid does not remember the current page and defaults to first page. Save fails because the edited row is not on the first page.
Minor technical detail which might have an impact on this: After initial page load, when we click Next-button, nothing happens. When clicking again, we get the second page. By debugging we notice that the pager routine is executed twice. First outcome is that we are on first page. Then the routine is called again, and now we are not the second page. This “iterative” page changing seems to happen also during batch save.
Any ideas or workarounds on this? Is the combination of custom pager + batch edit supported in the first place?
Hello SharpCoder,
The batch updating feature introduces several differences to the updating process compared to the default behavior.
Normally when specific row is edited and then losses focus callback is made to the Server in order to update this change to the Data Source. When batch updating is enabled there is no such callback and changes are accumulated on the Client.
When paging is used in such batch scenario the call to the Server is executed when page is changed via pager (in default pager case). Batch updating is executed by default when Postback occurs on the page or when the grid itself performs callback (on paging for example). This is shown in the following sample - http://www.infragistics.com/products/aspnet/sample/data-grid/batch-updating-events
When custom paging is implemented such call is most probably missing and this is why batch updating does not send the data back to the Server on page change.
Currently forsing a Postback on page change or usage of grid's default pager is recommended in such scenarios.
Hello,
We are still following up your case. If you have more questions or concerns or if you need any further assistance with this case please let us know.
Thank you for the answer. However, I'm not sure if this issue is caused by a missing postback. Every time we click our custom pager, a postback happens. We can verify this by VS2010 debugger. The PageChanged event in our custom pager control is fired as well.
But since in your sample paging is clearly working with batch update, there must be some differences with our custom pager. We tried going back to the default pager, but for some reason, it is not working at all. Nothing happens when we click the page numbers. And in any case, the default pager is not user-friendly in our implementation, where the number of pages can easily reach 50 or 100 pages. A dropdown menu + prev/next -buttons are clearly better.
If you could provide a working sample using both custom pager and batch edit, we could examine it and try to figure out the differences with our implementation. Thanks!