title: Display only not null records in model
body: <p>This is the method in controller:</p>
  
  <pre><code>public ActionResult Details(int id = 0)
  {
      //CourseCategory courseCategory = db.CourseCategories.Find(id);
      CourseCategory courseCategory = db.CourseCategories.Include(s =&gt; s.Files).SingleOrDefault(s =&gt; s.ID == id);
      if (courseCategory == null)
      {
          return HttpNotFound();
      }
  
      return View(courseCategory);
  }
  </code></pre>
  
  <p>This is view:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td style="color: #3399FF; font-weight: bold;"&gt;
          &lt;div class="display-label"&gt;
              @Html.DisplayNameFor(model =&gt; model.courseField)
          &lt;/div&gt;
      &lt;/td&gt;
  
      &lt;td&gt;
          &lt;div class="display-field"&gt;
              @Html.DisplayFor(model =&gt; model.courseField)
          &lt;/div&gt;
      &lt;/td&gt;
  </code></pre>
  
  <p></p>
  
  <p>
         
              
                 @Html.DisplayNameFor(model => model.courseSubject)
              
         </p>
  
  <pre><code>   &lt;td&gt;
          &lt;div class="display-field"&gt;
             @Html.DisplayFor(model =&gt; model.courseSubject)
          &lt;/div&gt;
     &lt;/td&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is how I retrieve model data into table. I want to hide the label and its containing tr tag if the record is empty. I don't want to show null records. How can I do that?</p>