我有一个部分观点,即在将项目添加到数据库时需要更新。
Index.cshtml:
@using (Ajax.BeginForm("Index", "WinEntry", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "wingrid", InsertionMode = InsertionMode.Replace}))
{
@Html.Partial("_winVenue")
@Html.Partial("_singleWin")
}
<div id="wingrid">
@Html.Partial("_wingrid")
</div>
_singleWin 有提交按钮
控制器:
[HttpPost]
public ActionResult Index(Win win)
{
win.dealerId = "1234567890";
win.posterid = "chris";
win.posttime = DateTime.Now;
wem.addWin(win);
IEnumerable<Win> w = wem.getVenueWins(win.venue,win.windate);
return PartialView("_wingrid",w);
}
当控制器返回部分视图 _wingrid 时,它会将其作为新页面返回,我正在寻找的行为就像 wingrid div 内的更新面板。
任何帮助,将不胜感激。