嘿所有即时通讯都有ajax问题,我只是尝试更新局部视图,但不是重新创建部分视图,而是重复显示部分视图的整个页面
控制器
[HttpGet]
public PartialViewResult updatelist()
{
return PartialView("ForumTopicList");
}
视图
using (Ajax.BeginForm("updatelist", "Forums", new AjaxOptions
{
InsertionMode = InsertionMode.Replace, UpdateTargetId = "topiclist"
}))
{
<div>
<input type="submit" value="refresh" />
</div>
}
<div id="topiclist">
@{Html.RenderPartial("ForumTopicList", this.Model.Topics);}
</div>
希望它显而易见,谢谢所有
更新: 我现在所做的就是
using (Ajax.BeginForm(new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "topiclist" }))
{
<input type="submit" value="refresh" />
}
<div id="topiclist">
@{Html.RenderPartial("ForumTopicList", this.Model.Topics);}
</div>
仍然只是重复整个视图,然后视图的两个按钮和div中的重复视图工作正常:s