Ajax.Actionlink, partial and webgrid issue

I have the following issue.

My url structure is like this:


In my controller i have the following:

[AcceptVerbs(HttpVerbs.Post)] public PartialViewResult LoanRefresh(string id) { PeopleModel p = new PeopleModel(); return PartialView("_LoanHistory", p.getPersonLoanHistory(id)); }

In my view i have:

@Ajax.ActionLink("Refresh", "LoanRefresh", new { id = Model.IdentityCode }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "loanHistory", LoadingElementId = "Loading" }, new { @class = "button" })


<div id="loanHistory"> @Html.Partial("_LoanHistory", Model.Loans) </div>

When run the Ajax.ActionLink it gets the data back ok and it updates the div, but the url of the sort links on the webgrid then change their address to:


i need to stay as:


Any help would be greatly appreciated.

-------------Problems Reply------------

Well @Nick, that's because your action name is LoanRefresh and not Refresh. To do that you will probably have to do some routing or even redirect your LoanRefresh results to an action named Refresh.

Try setting ajaxUpdateContainerId to an object that is specified in the partial view, rather than an object in the view from which the partial view is originally called. The sort URLs should work correctly then.

Category:asp.net mvc Views:1 Time:2011-05-09

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.187 (s). 11 q(s)