加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net mvc partialview @ Ajax.ActionLink不起作用

发布时间:2020-12-16 04:35:12 所属栏目:asp.Net 来源:网络整理
导读:我有一个视图页面 我的观点页面 div id="beReplaced" @Ajax.ActionLink("please click on me to bring the partial view","PatrialViewToBeCalled",new AjaxOptions() {UpdateTargetId = "beReplaced",InsertionMode = InsertionMode.InsertAfter,HttpMethod
我有一个视图页面

我的观点页面

<div id="beReplaced">
    @Ajax.ActionLink("please click on me to bring the partial view","PatrialViewToBeCalled",new AjaxOptions()
                        {UpdateTargetId = "beReplaced",InsertionMode = InsertionMode.InsertAfter,HttpMethod="Get",LoadingElementId = "prgress" })
 </div>

我有一个控制器

public PartialViewResult PatrialViewToBeCalled()
{
    var customer = db.Customers.First();

    return PartialView("PartialViewThatMustBeShow",customer);
}

但是当我点击生成的链接时,它会将我带到一个新页面而不是
将部分视图替换或附加到div标签.

有什么问题?

解决方法

可能是你错过了:
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>

在主视图中.这告诉主视图识别ajax助手.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读