title: How to get HTML table with header data from database and row data from database as well in mvc 4
body: <p>I am working in mvc project where I want to generate one gridview(html table). The headers should bind from db and data also should bind from db dynamically. 
  This is my metadata or master table.</p>
  
  <pre><code>Id      Name    Label           Value         Emp_id
  31      Adhar   DocumentNumber  12345678       1
  32      Adhar   ExpiryDate      1/1/2015       1
  33      Pan     DocumentNumber  123456789      2
  34      Pan     ExpiryDate      1/1/2015       2
  36      Pan     IssueLoc        India          2
  </code></pre>
  
  <p>and my table should be like this below. if the input parameter emp_id is 1 then table should look like below. This is HTML</p>
  
  <pre><code>&lt;Table&gt;&lt;tr&gt;&lt;th&gt;DocumentNumber&lt;/th&gt;&lt;th&gt;ExpiryDate&lt;/th&gt;&lt;td&gt;12345678       &lt;/td&gt;1/1/2015&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  </code></pre>
  
  <p>OR
  this is plain web sheet.</p>
  
  <pre><code>DocumentNumber   ExpiryDate
  12345678         1/1/2015 
  </code></pre>
  
  <p>I am working in mvc4 entity framework. How to overcome from this? Can anybody give me some idea to solve it. I have googed across and found nothing. Please provide me some idea. If question is uncleared please let me know</p>
  
  <p>This is for emp_id with 2</p>
  
  <pre><code>DocumentNumber   ExpiryDate  IssueLoc
  12345678         1/1/2015    India
  </code></pre>
  
  <p>With respect to above data I need output in the form of</p>
  
  <pre><code>    Name   DocumentNumber   ExpiryDate
      Adhar  12345678         1/1/2015
      Name   DocumentNumber   ExpiryDate  IssuedLoc
      Pan    123456789        1/1/2015    India
  </code></pre>
  
  <p>Yes, The answer you provided is almost correct as per my requirement. I tried myself to make table as I need but I could not get it. Sorry for troubling you</p>