MVC4 Ajax.BeginForm not replacing UpdateTargetId

后端 未结 12 1406
野的像风
野的像风 2020-12-30 04:38

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<

12条回答
  •  情深已故
    2020-12-30 05:27

    Wow, there are a lot of answers here. My problem was due to a bootstrap panel. It was creating a "nested" panel. I removed the panel markup and just used a plain old div and it worked. I think the UpdateTargetId has to be a direct parent of the AJAX form.

    Here is the html illustrating the problem.

    @using (Ajax.BeginForm("EditNote", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = "notes-form" }, htmlAttributes: new { @class = "form-horizontal" })) { }

提交回复
热议问题