title: Convert rows in table to columns for displaying into Header columns for Gridview
body: <p><strong>1st Problem</strong>  </p>
  
  <p>I have a table</p>
  
  <pre><code>CatID   Category    IsArchived  
  1       Category1   0  
  3       category2   0  
  4       Category3   0  
  5       Category4   0  
  6       Category5   0  
  7       Category6   0  
  8       Category7   0  
  </code></pre>
  
  <p>I want to convert rows to columns so that I have all categories in one row with column for each category.</p>
  
  <p>Also, I want to bind this data to the Header column of a <code>Gridview</code></p>
  
  <p><strong>2nd Problem</strong>  </p>
  
  <p>I have another table:</p>
  
  <pre><code>CCtID  ClientID CatID  CatStatus Date                  modifiedby  
  1      1        1      1         2013-06-03 22:19:00   1  
  2      1        3      1         2013-06-03 22:20:00   1  
  3      1        4      0         2013-06-03 22:20:00   1  
  4      1        5      0         2013-06-03 22:20:00   1  
  5      1        6      1         2013-06-03 22:20:00   1  
  6      1        7      1         2013-06-03 22:20:00   1  
  7      1        8      0         2013-06-03 22:20:00   1  
  8      2        8      0         2013-06-03 22:21:00   1  
  9      2        7      0         2013-06-03 22:21:00   1  
  10     2        6      0         2013-06-03 22:21:00   1  
  11     2        5      1         2013-06-03 22:21:00   1  
  12     2        4      1         2013-06-03 22:21:00   1  
  13     2        3      0         2013-06-03 22:21:00   1  
  14     2        1      0         2013-06-03 22:22:00   1  
  </code></pre>
  
  <p>I want to display categories and their status for each client in column format:</p>
  
  <pre>
  clientName  cat1  cat2  cat3  cat4  cat5  cat6  
  1           1     0     1     o     1     1
  </pre>