title: Webmatrix: passing ModelState to partial page
body: <p>I am building a WebPages site and have an issue when I try to pass <code>ModelState</code> data to a partial page.</p>
  
  <p>Here is the code for Create.cshtml:</p>
  
  <pre><code>@{
      Page.Title = "Create Fund";
  
      var name = "";
  
      if (IsPost) {
          name = Request.Form["name"];
  
          if (!name.IsValidStringLength(2, 128)) {
              ModelState.AddError("name", "Name must be between 2 and 128 characters long.");
          }
      }
  }
  
  @RenderPage("_fundForm.cshtml", name)
  </code></pre>
  
  <p>Here is the code for _fundForm.cshtml:</p>
  
  <pre><code>@{
      string name = PageData[0];
  }
  
  &lt;form method="post" action="" id="subForm"&gt;
      &lt;fieldset&gt;
          @Html.ValidationSummary(true)
          &lt;legend&gt;Fund&lt;/legend&gt;
          &lt;p&gt;
              @Html.Label("Name:", "name")
              @Html.TextBox("name", name)
              @Html.ValidationMessage("name", new { @class = "validation-error" })
          &lt;/p&gt;
          &lt;p&gt;
              &lt;input type="submit" name="submit" value="Save" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The issue I am having is when there is an error for "name", the validation error does not display. Is there a special way to pass <code>ModelState</code> between the two pages?</p>
  
  <p><code>_fundForm</code> is going to be shared between Create.cshtml and Edit.cshtml.</p>