title: MVC3 - 4 Multiple Forms using Partial Views
body: <p>So, I am creating an Admin page that I would like to put multiple forms on.  So, I tried doing it using a Partial View and RenderAction.</p>
  
  <p>My Admin Index View:</p>
  
  <pre><code>@model Rad.ViewModels.AdminViewModel
  @{
  ViewBag.Title = "Admin";
  }
  
  &lt;h2&gt;Admin&lt;/h2&gt;
  
  &lt;div&gt;
  @{ Html.RenderAction("AddProduct"); }
  &lt;/div&gt;
  </code></pre>
  
  <p>My Partial View:</p>
  
  <pre><code>@model Rad.ViewModels.AdminAddProductViewModel
  
  @using (Html.BeginForm("AddProduct", "Admin"))
  {
  &lt;h1&gt;@Html.LabelFor(model =&gt; model.Name)&lt;/h1&gt;
  @Html.TextBoxFor(model =&gt; model.Name)
  @Html.ValidationMessageFor(model =&gt; model.Name)
  &lt;input type="submit" value="Add"/&gt;
  }
  </code></pre>
  
  <p>My Admin Controller:</p>
  
  <pre><code>public class AdminController : Controller
  {
      //
      // GET: /Admin/
      public ActionResult Index()
      {
          return View();
      }
  
      public ActionResult AddProduct()
      {
          return PartialView();
      }
  
      [HttpPost]
      public ActionResult AddProduct(AdminAddProductViewModel data)
      {
          if (ModelState.IsValid)
          {
  
          }
          return View("Index");
      }
  }
  </code></pre>
  
  <p>The issue is with the HttpPost version of AddProduct.  If I keep it as return View("Index"), it gets into an infinite loop.  But, if I return PartialView(data), it correctly shows the error, but does not have the Index view around it.  So, it only shows the Partial View.  Is there a way to have multiple forms on the one page and return the server-side validation to the page?</p>