title: Build HTMLTable from C# Serverside with InnerHtml string
body: <p>I am trying to loop through my client side Html table contents on my c# server side.  Setting the Html table to <code>runat="server"</code> is not an option because it conflicts with the javascript in use.</p>
  
  <p>I use ajax to pass my clientside html table's InnerHtml to my server side method.  I thought I would be able to simple create an <code>HtmlTable</code> variable in c# and set the <code>InnerHtml</code> property when I quickly realized this is not possible because I got the error <code>{"'HtmlTable' does not support the InnerHtml property."}</code></p>
  
  <p>For simplicity , lets say my InnerHtml string passed from client to server is:</p>
  
  <pre><code>string myInnerHtml = "&lt;colgroup&gt;col width="100"/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;hello&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;"
  </code></pre>
  
  <p>I followed a post from another stack overflow question but can not quite get it working.</p>
  
  <p>Can someone point out my errors?</p>
  
  <pre><code>string myInnerHtml = "&lt;colgroup&gt;col width="100"/&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;hello&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;"
  
  HtmlTable table = new HtmlTable();
  System.Text.StringBuilder sb = new System.Text.StringBuilder(myInnerHtml);
  System.IO.StringWriter tw = new System.IO.StringWriter(sb);
  HtmlTextWriter hw = new HtmlTextWriter(tw);
  table.RenderControl(hw);
  
  for (int i = 0; i &lt; table.Rows.Count; i++)
  {
      for (int c = 0; c &lt; table.Rows[i].Cells.Count; i++)
      {
          // get cell contents
  
      }
  }
  </code></pre>