title: Why aren't model errors showing in partial view in MVC?
body: <p>I am working on MVC-4 application. I have 2 action in 2 different controller like:</p>
  
  <p><em>Parent</em></p>
  
  <pre><code>Public ActionResult Detail(int id)
  {
    var p = parent.GetById(id);
    ViewBag.Child = TempData["Child"];
    return View(p);
  }
  </code></pre>
  
  <p><em>Child</em></p>
  
  <pre><code>Public ActionResult Create(Child child)
  {
    if(ModelState.IsValid)
    {
     //code save to db
    }
    TempData["Child"] = child;
    return RedirectToAction("Detail", "Parent", new { id = child.ParentId });
  }
  </code></pre>
  
  <p>I have a parent view and a partial child view. Child view renders inside parent view (Child view contains a form to create new child for parent). When user add new child, we send child data to child controller's create action and after successful save we return user to the same parent from where he/she added the child. For this reason we redirect the user to parent controller's detail action. And if any validation error occur than also we redirect to parent controller's detail action but this time we save the child object inside TempData to keep modelstate error.</p>
  
  <p><em>My parent detail view is :</em></p>
  
  <pre><code>.....
  ......
  
  @if (ViewBag.Child == null)
  {
      Html.RenderPartial("_AddChildPartial", new ViewDataDictionary { { "parentId", Model.Id } });
  }
  else
  {
      Html.RenderPartial("_AddChildPartial", ViewBag.Child as xxxx.Models.Child);
  }
  </code></pre>
  
  <p>Here i am first check whether the viewbag contains child object if yes than we pass that child obejct to _AddChildPartial view.To show the model error and data which user filled in the form.The data shows successfully but the model error are not showing.</p>
  
  <p>Can anybody please tell me what i doing wrong here, why model errors are now showing in _AddChildPartial View ? </p>