Ajax update after Delete action on Index view in ASP.MVC
I'm trying to do an Ajax delete in a fairly standard Index view, i.e. I have a generated Index view with one added filter drop-down, of little relevance here. I have changed the free Delete Html.ActionLink on every row to an Ajax.ActionLink, and the delete and ajax update work, but whichever container div I try and update, I always somehow get some kind of nesting in the updated page, e.g. after a delete and update, I get duplicate Home and About links from the master page inside my content.
Here is my current action link that causes what I describe above:
<%: Ajax.ActionLink("Delete", "Delete", new { id = item.InstallationDBNumber }, new AjaxOptions { UpdateTargetId = "jobList" }) %>
... and here is where jobList
is located, just outside the table used for the index list:
<div style="clear: both;">
</div>
<div id="jobList" class="index-list">
<table>
<tr&开发者_开发百科gt;
You should post your code for your Delete action method on your controller. But from the sounds of it, you are returning Return View(myModel)
instead of Return PartialView("partialViewName", myModel)
.
Create a partial view contianing the layout information for jobList and return that from your controller action method.
精彩评论