title: List and Single-Variable in View-Specific Model
body: <p>I'm creating a page where users can search for a specific school, then view their search results. As such, I think I need a view-specific model that includes both a list of entities as well as a single entity (for the search term). The error I'm encountering is that "DashboardViewModel contains no definition for listschools..." </p>
  
  <p>I've created model as such:</p>
  
  <pre><code> public class DashboardViewModel
  {
  [Display(Name = "University Name")]
  public string name { get; set; }
  
  public List&lt;SchoolViewModel&gt; listschools { get; set; }
  }
  
   public class SchoolViewModel
  {
  public string instnm { get; set; }
  }
  </code></pre>
  
  <p>And I'm trying to accesss both elements in the view as follows, after declaring the model with "@model DashboardViewModel":</p>
  
  <pre><code>  &lt;table&gt;
              @foreach (var u in Model.listschools)
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                         @u.instnm
                      &lt;/td&gt;
  
                  &lt;/tr&gt;
              }
  &lt;/table&gt;
                  @using (Html.BeginForm("Index", "Dashboard", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
                  {
  
                      @Html.AntiForgeryToken()
                      @Html.ValidationSummary("", new { @class = "text-danger" })
  
                      &lt;div class="row form-group"&gt;
                          &lt;div class="col-md-5"&gt;
                              @Html.LabelFor(m =&gt; m.name, new { })
                              @Html.TextBoxFor(m =&gt; m.name, new { @class = "form-control" })
  </code></pre>