mvc4 ajax beginform,c# - MVC4 Ajax.BeginForm not replacing UpdateTargetId - Stack Overflow

There are so many topics on SO about issues with the Ajax.BeginForm not correctly updating the target element with the return partial view:

mvc4 ajax updating same page

ASP.NET MVC 4 - Ajax.BeginForm and html5

MVC 4 (razor) - Controller is returning a partialview but entire page is being updated

MVC 4 Ajax is not updating the PartialView within the page

However, all of these are answered by either manually writing out the jQuery ajax, or including a missing javascript file.

@using (Ajax.BeginForm("PostcardDetails", new AjaxOptions()

{

InsertionMode = InsertionMode.Replace,

UpdateTargetId = "details"

}))

{

@{Html.RenderAction("PostcardSearchResults", Model);}

}

Relevant controller code:

[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)]

public ActionResult PostcardSearchResults(PostcardSearchFilter filter)

{

PostcardSearchResults model = new PostcardSearchResults(filter);

return PartialView("_PostcardSearchResults", model);

}

In my layout, I am referencing these jQuery files. Additionally, I've verified that the page is outputting the proper path, and that it finds the correct files. I've tried switching the ordering of unobtrusive-ajax.min.js and validate.min.js, to no success.

Additionally, in my website's root web.config, and the web.config in my View folder, I have included:

I'm at a loss for where else to look. There are no javascript errors being thrown, and the controller is being properly hit, returning a PartialViewResult. The Form element in the HTML is populating all the correct data- attributes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值