asp.net mvc 3 webgrid sorting remains ?sortdir=ASC

后端 未结 4 1059
谎友^
谎友^ 2021-02-04 08:54

I\'m experimenting a bit with several grids in asp.net mvc. Microsoft has a grid too know in the prerelease of mvc 3 so I thought I\'ll try that one out.

The basic funct

4条回答
  •  深忆病人
    2021-02-04 09:08

    I'm not sure why DESC isn't switchign to ASC. I have a similar example and it works just fine. Ttry using the ajax container(ajaxUpdateContainerId). This could help, if nothing else it would solve the issue you are having with the httpget request, maintaining your search result. Here is what I have: (I'm using razor, but should be easy enough to convert).

    Simply add the new property: ajaxUpdateContainerId: "div_name"

    Wrap the grid with a div having an ID of div_name

    @{
    var grid = new System.Web.Helpers.WebGrid(Model.SubscriptionList, canPage:false, ajaxUpdateContainerId: "grid");  
    }
    
    @grid.GetHtml(columns: grid.Columns( grid.Column(format:(item) => Html.ActionLink("Edit", "Edit", new { id=item.Id })), grid.Column("ISP"), grid.Column("ABONNEMENT")))

    Best of luck, hope it helps!

提交回复
热议问题