title: ASP.NET - Ideal Control to Display a Pivot Table
body: <p>I am trying to display a tabular set of data in a databound control, but I need to pivot the table such that the individual records are table columns rather than table rows. The end result is a table with a fixed number of columns and a variable number of rows each displaying single field for all of the records <a href="http://www.ratedgolf.com/Community/Users/Scorecard.aspx?p1PpslL7Gfba2ChYteudYA%3d%3d" rel="nofollow noreferrer">like this</a>. Due to the fact that the &lt;tr /&gt; tags would have to be defined for each field, rather than each record, a repeater isn't a suitable way to go about this. What I am wondering is if there are any built in ASP.NET controls that can achieve what I want. I was eying the ListView control, however I am not certain if it is in fact capable of what I'm describing.</p>
  <p>Effectively, assuming records like the following:</p>
  <pre><code>       Number Yardage Par  ...
  (Hole)   1     300     4   ...
  (Hole)   2     275     4   ...
  (Hole)   3     390     5   ...
  (Hole)  ...    ...    ...  ...
  </code></pre>
  <p>I need to display:</p>
  <pre><code>           1   2   3   ...
  Yardage:  300 275 390  ...
      Par:   4   4   5   ...
      ...:  ... ... ...  ...
  </code></pre>
  <p>A viable alternative to fighting with &lt;tr /&gt; tags would of course be to use display: inline &lt;divs&gt; with some graceful CSS, but if I can preserve the &lt;table&gt; structure that would be ideal.</p>
  <p>Thanks!</p>