title: ASP.NET how to populate html table on asp button click
body: <p>I am trying to populate an html table with rows based on what a c# function returns on a button click. </p>
  
  <pre><code>&lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Populate" /&gt;&lt;/div&gt;&lt;br&gt;
  
  &lt;table id ="randtable" class="tablex"&gt;
    &lt;tr&gt;
      &lt;th&gt;Col1&lt;/th&gt;
      &lt;th&gt;Col2&lt;/th&gt;
      &lt;th&gt;Col3&lt;/th&gt;
      &lt;th&gt;Col4&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>and my Button1_Click function looks like this:</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      List&lt;Entity&gt; x = someFunction();
      //I want to have each row in the table represent each entity. Assume each entity has 4 attributes which would go in Col1,Col2,Col3,Col4 in the table.
  }
  </code></pre>
  
  <p>Any idea how to do this? The reason I'm sticking with an html table instead of an asp control table is to keep the css of the html table, unless there's a way to make the asp table look appealing as well.</p>