title: TempData status message from partial view of another controller
body: <p>Having an issue trying to get <code>TempData</code> messages back from a partial view,
  I am rendering a partial view of another controller in my main view like so:</p>
  
  <pre><code>@{
      UserProfile Model = ViewData["model"] as UserProfile;
  }
  
  @{Html.RenderPartial("~/Views/MyProfile/Index.cshtml", Model);
  }
  </code></pre>
  
  <p>However I cant seem to access the TempData messages of this partial view in my Main view or even in the PartialView? Nothing is displayed after I submit the changes.</p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Update(UserProfile model, HttpPostedFileBase Picture)
      {
          if (ModelState.IsValid)
          {
              if (Picture != null &amp;&amp; Picture.ContentLength &gt; 0)
              {
                  // delete first
                  string todelete = model.PreviousPicture;
                  if (todelete != null &amp;&amp; !todelete.Equals(""))
                  {
                      //....
                  }
  
                  //....
  
                  UserProfile up = _db.UserProfiles.SingleOrDefault(u =&gt; u.UserId == model.UserId);
                  //....
  
                  try
                  {
                      UpdateModel(up);
                  }
                  catch (Exception)
                  {
                      TempData["Message"] = "Please ensure all required fields are supplied.";
                      return RedirectToAction("Index");
                  }
  
                  if (ModelState.IsValid)
                  {
                      //...
                      _db.SaveChanges();
                      TempData["Success"] = "Profile was updated successfully.";
                      return RedirectToAction("Index");
                  }
  
              }
              else
              {
  
                  UserProfile up = _db.UserProfiles.SingleOrDefault(u =&gt; u.UserId == model.UserId);
  
                  //.....
                  try
                  {
                      UpdateModel(up);
                  }
                  catch (Exception)
                  {
                      TempData["Message"] = "Please ensure all required fields are supplied.";
                      return RedirectToAction("Index");
                  }
  
                  if (ModelState.IsValid)
                  {
                      _db.Entry(up).CurrentValues.SetValues(model);
                      _db.SaveChanges();
                      TempData["Success"] = "Profile was updated successfully.";
                      return RedirectToAction("Index");
                  }
              }
          }
  
          TempData["Message"] = "Please ensure all required fields are supplied.";
  
          return RedirectToAction("Index");
      }
  }
  </code></pre>
  
  <p>In the partial view I display the messages like so:</p>
  
  <pre><code>@Html.Partial("_ValidationPartial")
  </code></pre>
  
  <p>However once redirected after I submit, no message is displayed in the partial?</p>
  
  <p>This is the _validationPartial: </p>
  
  <pre><code>@if (!Html.ViewData.ModelState.IsValid)
  {
      foreach (ModelState modelState in ViewData.ModelState.Values)
      {
          foreach (ModelError error in modelState.Errors)
          {
              &lt;div class="alert alert-error alert-warning alert-dismissable message-error"
                   style="font-size: 13px; color: #d01616; margin-bottom: 0px; padding: 10px;
         text-align:left;padding-left:30px;"&gt;
                  @error.ErrorMessage
              &lt;/div&gt;
          }
      }
      &lt;br /&gt;
  }
  
  @if (@TempData["Message"] != null)
  {
      &lt;div class="alert alert-error alert-warning alert-dismissable message-error"
           style="font-size: 13px; color: #d01616; margin-bottom: 0px; padding: 10px;
         text-align:left;padding-left:30px;"&gt;
          @TempData["Message"]
      &lt;/div&gt;
      &lt;br /&gt;
  }
  @if (@TempData["Success"] != null)
  {
      &lt;div class="alert alert-success message-success"
           style="font-size: 13px; color: green; margin-bottom: 0px; padding: 10px;
         text-align:left;padding-left:30px;"&gt;
          @TempData["Success"]
      &lt;/div&gt;
      &lt;br /&gt;
  }
  </code></pre>