从演示解决方案中,我尝试使用内置的 mvc ajax 功能。但由于某种原因,部分视图没有被替换。
@using (Ajax.BeginForm("RefreshPartial", "Home", new AjaxOptions() { UpdateTargetId = "PartialToRefresh", HttpMethod = "Post" }))
{
@Html.TextBox("Name");
<input type="submit" value="Send name" />
}
<br />
<div>
@Ajax.ActionLink("Just refresh", "RefreshPartial", "Home", null, new AjaxOptions() { UpdateTargetId = "PartialToRefresh", HttpMethod = "Post" }, null)
</div>
<br />
<div id="PartialToRefresh">
@Html.Partial("_DateTimePartial", "test")
</div>