I am using MVC3 (Razor) with open source paging here . Calling a code when the Controller button that has this code is pressed:
[Authorize(Roles = SystemConstants.ROLE_ADMINISTRATOR)]
public ActionResult ListUsers(int? page)
{
int currentPageIndex = page.HasValue ? page.Value - 1 : 0;
var products = userToDisplay.ToPagedList(currentPageIndex, 5);
return PartialView("ListUsersTable", products);
}
This should return a PartialView called "ListUsersTable". It returns "ListUsersTable", but as a whole page instead of replacing the DIV.
Here is the code in the view:
<div id="listUserToBeUpdated">
@Html.Partial("ListUsersTable", Model)
</div>
The button inside the ListUsersTable to call Ajax looks like this:
<div class="pager">
@Ajax.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount, "ListUsers", new AjaxOptions { UpdateTargetId = "listUserToBeUpdated" })
</div>
Any idea why the code does not replace the DIV, but instead returns the code on the page?
source
share