0

I am using the code from the following link:

http://stick2basic.wordpress.com/2013/03/18/efficient-paging-and-sorting-with-webgrid-web-helper-asp-net-mvc/

When I click on the column header name the first time, it sorts the column ascending. But when I click the column header name a second time, it asks me "Do you want to open or save EfficientPaging.json?"

Also, I tried the following solution, but it returns a page with text on the second column header click.

IE9 JSON Data "do you want to open or save this file"

Community
  • 1
  • 1
Sun Sun Ku
  • 337
  • 1
  • 6
  • 17

2 Answers2

0

Hard to say without downloading and building the entire code locally, but I can tell you that the following jQuery method isn't getting correctly applied to the header links that are being returned from the second call to getPageData (i.e., the call that is made when you click on the header the first time). Instead the link on the .header a element is simply going directly to the server to get the JSON result. I would start there.

$(".header a").live("click", function (e) {
    var Parameters = e.target.search;
    var sort = getParameterByName("sort", Parameters);
    var sortdir = getParameterByName("sortdir", Parameters);
    $("#hdnSort").val(sort);
    $("#hdnSortDir").val(sortdir);
    getPageData(e, d, "First");
    return false;
});
Lars Kemmann
  • 5,509
  • 3
  • 35
  • 67
0

I ended up using the pagedlistpager helper for the paging, sorting, and filtering for the webgrid.

Sun Sun Ku
  • 337
  • 1
  • 6
  • 17