Ajax.BeginForm 防止跳转到新页面

@using (Ajax.BeginForm("ChangeCompanyId", "navigation", new { area = "configs" }, new AjaxOptions() { UpdateTargetId = "NavigationTree", OnSuccess = "InitTreeNode" }))
{
    @Html.DropDownList("CompanyId")
}
<link href="@Url.Content("~/Content/themes/Common/css/jquery.treeview.css")" rel="stylesheet" />
<div style="display: none;">
    @Html.CheckBox("IsBarringChildrens", (bool)ViewBag.IsBarringChildrens)
    <span>不含子导航
    </span>
</div>
<div id="NavigationTree">
    @Html.Action("TreeNode", new { CompanyId = (int)ViewBag.CompanyIdValue })
</div>

要引用下面的。

<script src="@Url.Content("~/Scripts/Common/jquery/jquery.unobtrusive-ajax.min.js")"></script>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。