title: How can I create a view that shows both master and detail information using a viewmodel in MVC?
body: <p>I have the following viewmodel:</p>
  
  <pre><code>namespace WebUx
  {
      public class CityViewModel
      {
          public City City { get; set; }
          public IList&lt;CityDetail&gt; CityDetails { get; set; }
      }
  }
  </code></pre>
  
  <p>The following master class:</p>
  
  <pre><code>Class City {
       public string Name { get; set; }
       public string Type { get; set; }
  }
  </code></pre>
  
  <p>The following detail class:</p>
  
  <pre><code>Class CityDetail {
       public string   Number { get; set; }
       public string   Street { get; set; }
  }
  </code></pre>
  
  <p>What I would like to do is to use the viewmodel in a view where a form in the view will first show some basic city information and then have an area at the bottom where there are <strong>ten</strong> CityDetail records. </p>
  
  <p>Is there a way that I can do this with a partial view? I understand some things about the partial view but how could I write this to meet my needs? Can I even call a partial view from within a view and at the same time create blank records with details that can be filled in and that would be part of the model when I return to my action. How could I handle labels also. For example I would like the labels for each Street to show as "Street 1", "Street 2" etc.</p>