【发布时间】:2014-04-17 12:48:53
【问题描述】:
在我的 ASP.NET MVC 项目中,我遇到以下情况:
具有此操作的 ExController:
public ActionResult Index()
{
//Get Data from Repository
return View(Model);
}
在 Ex View 中,我有一个 Index.cshtml 和一个 _PartialIndexGrid.cshtml。
在索引中,我有一个带有复选框的功能区菜单,当我单击它时,我只想刷新放置在 _PartialIndex.cshtml 上的网格,这可能吗?
索引视图:
//Ribbon Code here
@Html.Partial("_PartialIndexGrid", Model)
<script>
if (e.parameter) {
$.ajax({
url: '@Url.Action("Index")',
type: "get",
success: function (result) {
$("_PartialIndexGrid").html(result);
},
failure: function () {
alert('error');
}
});
</script>
此脚本实际上执行 ajax 请求,但不会重新加载网格局部视图。 谢谢。
【问题讨论】:
-
您是否将
@Html.Partial("_PartialIndexGrid", Model)包裹在某个 div 中? -
@Satpal 不,它不在 div 或其他东西中
标签: javascript jquery asp.net asp.net-mvc razor