title: How to remain/retain on the same page when using PagedList.mvc
body: <p>I am using PagedList.Mvc and I have added a nice way to navigate across various pages in a mvc web application. However, when I click on an "edit" or "details" tab and save changes I am sent back to the 1st page. I want to remain on the same page where the changes were made.</p>
  
  <p>Here is the code I have in the controller:</p>
  
  <pre><code>// GET: Item
      public ActionResult Index(int? page)
      {
          var items = db.Items.Include(i =&gt; i.PurchaseOrder);
          return View(items.ToList().ToPagedList(page ?? 1, 3));
      }
  </code></pre>
  
  <p>Here is the code I have in the view:</p>
  
  <pre><code>    @using PagedList;
  @using PagedList.Mvc;
  
  @model IPagedList&lt;PurchaseOrders.Models.Item&gt;
  
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().ItemDescription)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().Quantity)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().Price)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().DueDate)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().DateReceived)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().Comments)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.First().PurchaseOrder.PurchaseRequest_)
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.ItemDescription)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Quantity)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Price)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.DueDate)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.DateReceived)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Comments)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.PurchaseOrder.PurchaseRequest_)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.ItemId }) |
              @Html.ActionLink("Details", "Details", new { id=item.ItemId }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.ItemId })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  &lt;/table&gt;
  @Html.PagedListPager(Model, page =&gt; Url.Action("Index", new { page }))
  </code></pre>
  
  <p>Please help!</p>