title: ASP.NET MVC Model split across multiple Partial Views
body: <p>I'm developing a MVC 3 Razor Web App, in which details of multiple categories of objects are stored. (Vehicles, Houses, Instruments etc) . All the objects share some common data (Title, Description etc) And some details which are specific to the category in which it belongs to.   The Category list is expected to grow and in view of reducing maintainability we hope to reuse the same Add Object wizard . The wizard is based on the following implementation.</p>
  
  <p><a href="http://afana.me/post/create-wizard-in-aspnet-mvc-3.aspx" rel="nofollow">http://afana.me/post/create-wizard-in-aspnet-mvc-3.aspx</a> </p>
  
  <p>In the Multiple step wizard process , the final step allows the user to enter the category specific details (Model, Make, VIN etc for a Vehicle). Currently i've envisioned this final step as a Partial View with AJAX. So we will actually be having mulltiple partial views that reflect the specific category, but share the rest of the wizard code.</p>
  
  <p>My generic model object is like this</p>
  
  <pre><code>public class AssetView
  {
      [Required]      
      public string Title
       {
          get;
          set;
       }
  
      [Required]
      public string Description
      {
       get;
        set;
       }
  
      // Few more generic fields here
  
      public SpecificAsset AssetDetails { get; set; }
  }
  </code></pre>
  
  <p>The complex property AssetDetails is represented by each type of partial view. So the PartialView "MotorDetails" will contain a strongly typed model of type MotorAsset which is declared as below.</p>
  
  <pre><code>  public class MotorAsset : SpecificAsset
      {
          [Required]
          public string Transmission
          {
              get;
              set;
          }
  
          [Required]
          public string Make
          {
              get;
              set;
          }
       }
  </code></pre>
  
  <p>The actual validation is far complex , but i've omitted these so that's easier to understand.</p>
  
  <p>The Main Wizard page is declared as</p>
  
  <pre><code>    @model AssetView
  
    .....
  
    &lt;div class="wizard-step"&gt;
       ....
    &lt;/div&gt;
    &lt;div class="wizard-step"&gt;
       ....
    &lt;/div&gt;
    &lt;div class="wizard-step"&gt;
        @{Html.RenderPartial("_MotorCreate", Model.AssetDetails);
    &lt;/div&gt;
  </code></pre>
  
  <p>The Motor Partial View as </p>
  
  <pre><code> @model MotorAsset
  </code></pre>
  
  <p>My question is how can i accomplish model validation in this scenario (or is it possible to use), as the final step is not in the view page but on a partial view .</p>