ajax.actionlink更新div [英] ajax.actionlink updating divs

查看:53
本文介绍了ajax.actionlink更新div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我有一个包含两列的页面,其左手包含一些链接,而右手则根据所单击的内容显示其他数据.

Currently I have a page with two columns, the left hand of which contains some links and the right hand one displays additional data based on what was clicked.

当前,我很难获得Ajax.ActionLink方法来成功更新右侧列.

Currently I'm having difficulty getting the Ajax.ActionLink method to successfully update the right hand column.

当前我的页面看起来像这样:

Currently my page looks a bit like this:

<div id="lefthand">

@Ajax.ActionLink("Children", "ViewDetail", new { details = ViewBag.data }, new AjaxOptions() { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "details" })

</div>

<div id="righthand">

<ul id="details">

</ul>

</div>

但是,当我单击链接时,将创建一个新页面-不是我当前所在页面的一部分(我正在创建部分视图).

When I click on the link however, a new page is created - not a portion of the page I'm currently on (I'm creating a partial view).

我已在网站的另一部分成功使用了此功能,但更新的位在同一位置.那是问题吗?

I've used this sucessfully in another part of the site, but where the updated bit was within the same . Is that the issue?

推荐答案

我认为您可能缺少jquery.unobtrusive-ajax.js文件作为脚本参考.

I think you might be missing the jquery.unobtrusive-ajax.js file as a script reference.

这篇关于ajax.actionlink更新div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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