The Ajax.ActionLink below has an empty AjaxOptions. Surprisingly it automagically renders the ajax response into the modal and replaces the entire .modal-body element. My intention is to render the response into the #ItemCommentModalBody div. No matter how I set the UpdateTargetId and InsertionMode, even with an empty AjaxOptions, the response will replace the whole .modal-body div anyway. Is this a bug? The modal is triggered by bootstrap.
@Ajax.ActionLink("Add a comment", "AddComment", "Document", new { area = "", itemId = Model.ItemId }, new AjaxOptions { }, new { @class = "btn btn-warning", data_toggle = "modal", data_target = "#ItemCommentModal" })
<div id="ItemCommentModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lblItemCommentModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div id ="ItemCommentModalBody">
</div>
</div>
</div>
</div>
jquery.unobtrusive-ajax.js
file? – user3559349data_target = "#ItemCommentModal"
? – user3559349@Ajax.ActionLink
because that works fine. I can only assume it must be an issue with addingdata_target
and the way bootstrap modal works (I don't use it, so can't be sure if that's causing the problem) – user3559349