title: Partial view not rendering because TempData is null
body: <p>Here is part of my Index view:</p>
  
  <pre><code>@if (TempData["SucessAlert"] != null)
  {
      Html.RenderPartial("~/Views/Shared/_SuccessAlert.cshtml");
  }
  </code></pre>
  
  <p>Here is the partial view, _SuccessAlert.cshtml:</p>
  
  <pre><code>&lt;div class="alert alert-success alert-dismissable"&gt;
      &lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
      @TempData["SuccessAlert"]
      &lt;a href="@TempData["SuccessAlertLink"]" class="alert-link"&gt;@TempData["SuccessAlertLinkText"]&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is part of my controller:</p>
  
  <pre><code>TempData["SuccessAlert"] = "Successfully created account code " + mergedCode + ".";
  TempData["SuccessAlertLinkText"] = "Click here to view it.";
  TempData["SuccessAlertLink"] = "/AccountCode/Details?Division=" + viewModel.Division
      + "&amp;ProgramCode=" + viewModel.ProgramCode
      + "&amp;ProjectCode=" + viewModel.ProjectCode
      + "&amp;includeDisabled=False&amp;page=1";
  
  return RedirectToAction("Index");
  </code></pre>
  
  <p>Everything worked fine until I added the <code>@if()</code> statement to the view. Apparently <code>TempData["SuccessAlert"]</code> is always null when this <code>@if</code> statement is checked. Actually, if I change the <code>@if()</code> statement to <code>@if(true)</code>, it still works, so <code>TempData</code> has the correct values inside the partial view, even though it's null in view itself.</p>
  
  <p>Any idea what I'm doing wrong? (I'm using MVC5, if that matters.)</p>