I will explain what we are planning to achieve and would appreciate if someone can help.
We have a page with WebDataGrid, paging enabled. When user click on a row we take them to another ASPX page to view the details. There is a back button on the details screen that takes them back to the grid page.
Now the issue is that when they go back to grid page the paging is lost. I understand that it is not WebDataGrid related issue but any help would be appreciated.
Regards,
Tahir
Hi Tahir,
Similar is possible to implement. Application may create a hidden field which will store page index. On load from server (initial or full postback), that field should be empty. When page-index is changed, then that field should be updated with that value. On initialization grid may check value in that field and if it is not empty, then it means that the "back" feature of browser (or "back" from redirected page) from was used. So, value is hidden field can be used to restore state of grid before redirect. Below is example:
<script type="text/javascript">function initGrid(grid, args){ doBackState(grid, false);}function pageChanged(grid, args){ doBackState(grid, true);}function doBackState(grid, save){ var paging = grid.get_behaviors().getBehaviorByName('Paging'); var backState = $get('gridBackStateInput'); if(!paging || !backState) return; if(save) { backState.value = paging.get_pageIndex(); return; } var index = backState.value; if(index && index.length > 0) paging.set_pageIndex(parseInt(index));}</script> <input type="hidden" id="gridBackStateInput" /> <ig:WebDataGrid ID="WebDataGrid1" runat="server" ... > <ClientEvents Initialize="initGrid" /> <Behaviors> <ig:Paging> <PagingClientEvents PageIndexChanged="pageChanged" /> </ig:Paging> </Behaviors> ...