我正在尝试使用部分视图替换主视图中div的内容,具体取决于单击哪个@ Ajax.ActionLink.
最初我加载_CaseLoad局部视图然后我希望能够在单击相关的ActionLink时在两个部分视图_CaseLoad和_Vacancies之间切换.我在'Main'文件夹中找到了部分视图和索引视图.
当我点击'Vacancies'链接时,它会简要显示LoadingElementID,但它不会用_Vacancies局部视图替换_CaseLoad局部视图?
控制器动作(MainController):
public ActionResult Index(int page = 1, string searchTerm = null)
{
MainIndexViewModel model = new MainIndexViewModel()
// Populate Model
return View(model);
}
Run Code Online (Sandbox Code Playgroud)
主要指数观点:
@model Project.WebUI.Models.MainIndexViewModel
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="MainIndex">
<div id="Menu">
@Ajax.ActionLink("CaseLoad", "_CaseLoad", "Main", null, new AjaxOptions() { UpdateTargetId = "Main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET",
LoadingElementId = "busycycle" }) |
@Ajax.ActionLink("Vacancies", "_Vacancies", "Main", null, new AjaxOptions() { UpdateTargetId = "Main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET",
LoadingElementId …Run Code Online (Sandbox Code Playgroud)