title: asp.net mvc - pass partial data model to partial view
body: <p>I wish to build a partial view that gets a model column and print it.
  Something like that:</p>
  
  <p>At the view:</p>
  
  <pre><code>@model IEnumerable&lt;products_comparison.Models.Product&gt;
  @{
  ViewBag.Title = "Index";
  
  var Brand = (from r in Model
               select r.Brand).Distinct();
  }
  &lt;h2&gt;
  Index&lt;/h2&gt;
  
  @Html.RenderPartial("_DisplayAttribute",Brand)
  </code></pre>
  
  <p>And at the partial view:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              Brand
          &lt;/th&gt;
      &lt;/tr&gt;
      @foreach (var row in Model)
      {
          &lt;tr&gt;
              &lt;td&gt;
                  @Html.DisplayFor(r =&gt; row)
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p>There are a few problems I run into:</p>
  
  <ol>
  <li>The compiler doesnt allow me to send Barnd to the partial view.</li>
  <li>If you look at the partial view code you will see the word Brand, which is the column name. I dont wish to hard-coded the word "Brand" in the partial view, instead I like that the column name will be there.</li>
  <li>In the partial view I need to put @model products_comparison.Models.Product, but I dont 
  want to send the hole table. I want to send only one column - But I dont know what to put there..</li>
  </ol>
  
  <p>Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>Just to clear one thing, I want that the view will call the same partial view for each column in the table(for most of the columns in the table anyway) and each time I'll send a different column(distinct value column to be exact).</p>