1Am*_*ali 8 ajax asp.net-mvc asp.net-mvc-partialview
我有一个视图页面
我的观点页面
<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>
Run Code Online (Sandbox Code Playgroud)
我有一个控制器
public PartialViewResult PatrialViewToBeCalled()
{
var customer = db.Customers.First();
return PartialView("PartialViewThatMustBeShow",customer);
}
Run Code Online (Sandbox Code Playgroud)
但是当我点击生成的链接时,它会将我带到一个新页面,而不是将部分视图替换或附加到div标签.
有什么问题?
Pre*_*haA 10
可能是你错过了:
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
在主视图中.这告诉主视图识别ajax助手.
| 归档时间: |
|
| 查看次数: |
8192 次 |
| 最近记录: |