title: MVC3 Display the edit view on the same page as the list of items
body: <p>I have a list of transactions. When I click one of them, I'd like to be able to display the edit form (populated with the selected item's data) to the right of the list. Any ideas?</p>
  
  <p>Below is the partial view that displays the list of transactions.</p>
  
  <pre><code>@model IEnumerable&lt;BudgetPlus.Models.Transaction&gt;
  @{
      ViewBag.Title = "Index";
  }
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create", null, new { @class = "button-link" })
  &lt;/p&gt;
  &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th class="column-Date"&gt;Date&lt;/th&gt;
              &lt;th class="column-Description"&gt;Description&lt;/th&gt;
              &lt;th class="column-Category"&gt;Category&lt;/th&gt;
              &lt;th class="column-Amount"&gt;Amount&lt;/th&gt;
              &lt;th class="action-button"&gt;&lt;/th&gt;
              &lt;th class="action-button"&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @foreach (var item in Model)
          {
              &lt;tr&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Date)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Description)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Category.DisplayName)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Amount)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.ActionLink("Edit", "Edit", new { id = item.Id })
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.ActionLink("Delete", "Delete", new { id = item.Id })
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;div&gt;
      @Html.EditorForModel("Edit")
  &lt;/div&gt;
  </code></pre>
  
  <p>And this is what the edit method in my TransactionController looks like.</p>
  
  <pre><code>    public ActionResult Edit(int id)
      {
          Transaction transaction = db.Transactions.Find(id);
          ViewBag.CategoryId = new SelectList(db.Categories, "Id", "DisplayName", transaction.CategoryId);
          return View(transaction);
      }
  </code></pre>