分类:
MVC
1:用ajax的方式实现异步加载子页面:
function MasterPageJump(Url) { $.ajax({ url: Url, type: "GET", success: function (response) { $('#mainContent').html(response); } }); } 把跳转路径传入Url中就可以了 2:母版页再加一个Id <div id="main"> @RenderBody() </div> 3:子页面
@{
ViewBag.Title = "子页面";
Layout = Request.IsAjaxRequest() ? null : "~/Views/MasterPage.cshtml";
}
评价