title: MVC 3 Render Partial view
body: <p>I've had some problems when I try to render a PartialView.</p>
  
  <p>My Controller:</p>
  
  <pre><code>public ActionResult Index()
      {
          var db = new fanganielloEntities();
          List&lt;imovel&gt; imoveis = (from s in db.imovel
                                  where s.StatusImovel == 3
                                  select s).ToList();
  
          return PartialView(imoveis);
      }
  
       public ActionResult Listar()
       {
           return View();
       }
  </code></pre>
  
  <p>The View:</p>
  
  <pre><code> @Html.Partial("TesteLista")
  </code></pre>
  
  <p>The Partial:</p>
  
  <pre><code>@model List Mvc4Web.Models.imovel
      @if (Model != null)
      {
  foreach (var item in Model)
  {
              @Html.DisplayFor(modelItem =&gt; item.DescricaoImovel)
   }
      }
  </code></pre>
  
  <p>The Error:</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
    
    <p>Source Error: </p>
    
    <p>Line 5:   Line 6:   Line 7:  @foreach (var item in Model)  Line 8:   {
    Line 9:</p>
  </blockquote>
  
  <p>Thank in advanced!!!</p>