本文介绍了Ajax.BeginForm没有更新目标div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
查看:
@using(Ajax.BeginForm(AddBranchContact,新的AjaxOptions {HttpMethod =POST,UpdateTargetId =section3,OnSuccess = $('#myModal1')。modal('hide');}))
{}
型号:
View:
@using (Ajax.BeginForm("AddBranchContact", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "section3", OnSuccess = "$('#myModal1').modal('hide');" }))
{}
Model:
public JsonResult AddBranchContact(BranchViewModel objBranchContact)
{
List<BranchContact> BranchContactList = new List<BranchContact>();
if (Session["BranchContactList"] == null)
{
BranchContactList.Add(objBranchContact.BranchContactDetails);
Session["BranchContactList"] = BranchContactList;
}
else
{
}
return Json(BranchContactList, JsonRequestBehavior.AllowGet);
}
查看:
View:
@using (Html.BeginForm())
{
<div id="section3"><table>
</table></div>
The results returned from the action below are displayed in tr tds of this table. But when the action method below is called it gets the data but doesnt come back to this part : @using(Html.BeginFOrm()) even though i have given the UpdateTargetID as above.
}
推荐答案
public JsonResult AddBranchContact(BranchViewModel objBranchContact)
{
List<BranchContact> BranchContactList = new List<BranchContact>();
if (Session["BranchContactList"] == null)
{
BranchContactList.Add(objBranchContact.BranchContactDetails);
Session["BranchContactList"] = BranchContactList;
}
else
{
}
return Json(BranchContactList, JsonRequestBehavior.AllowGet);
}
查看:
View:
@using (Html.BeginForm())
{
<div id="section3"><table>
</table></div>
The results returned from the action below are displayed in tr tds of this table. But when the action method below is called it gets the data but doesnt come back to this part : @using(Html.BeginFOrm()) even though i have given the UpdateTargetID as above.
}
这篇关于Ajax.BeginForm没有更新目标div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!