Ajax.Actionlink,局部的和问题的WebGrid [英] Ajax.Actionlink, partial and webgrid issue

查看:108
本文介绍了Ajax.Actionlink,局部的和问题的WebGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题。

我的URL结构是这样的:

My url structure is like this:

/人/编辑/用户code

/people/edit/usercode

在我的控制器我有以下几点:

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));

    }

在我看来,我有:

@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>

在运行Ajax.ActionLink它获得的数据传回确定,它更新股利,但对的WebGrid排序链接的URL,然后他们的地址更改为:

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:

/人/ LoanRefresh / AFU0006排序= CreatedOn&放大器; sortdir = ASC

/People/LoanRefresh/AFU0006?sort=CreatedOn&sortdir=ASC

我需要保持为:

/人/ 修改 / AFU0006排序= CreatedOn&放大器; sortdir = ASC

/People/Edit/AFU0006?sort=CreatedOn&sortdir=ASC

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

好@Nick,那是因为你的动作名称为 LoanRefresh 而非刷新即可。要做到这一点,你可能会不得不做一些路由或甚至你LoanRefresh结果重定向到一个名为刷新操作。

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.

这篇关于Ajax.Actionlink,局部的和问题的WebGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆