title: Dynamically build a table into a placeholder
body: <p>I am attempting to build a table dynamically when a user hits a button. What i am trying to do is have it so that it will first build the headers of the table. </p>
  
  <p>My code for trying to do this is below. So when a user hits the create table button this method is run:</p>
  
  <pre><code>        private void AddTableTitles()
      {
          Literal startRow = new Literal();
          startRow.Text = "&lt;tr&gt;&lt;th colspan=\"2\"&gt;";
          Literal Column = new Literal();
          Column.Text = "&lt;/th&gt;&lt;th colspan=\"2\"&gt;";
          Literal endRow = new Literal();
          endRow.Text = "&lt;/th&gt;&lt;/tr&gt;";
  
          AssignPlaceHolder.Controls.Add(startRow);
          AssignPlaceHolder.Controls.Add(AddSiteHeader());
          AssignPlaceHolder.Controls.Add(Column);
          AssignPlaceHolder.Controls.Add(AddMachNameHeader());
          AssignPlaceHolder.Controls.Add(Column);
          AssignPlaceHolder.Controls.Add(AddMachTypeHeader());
          AssignPlaceHolder.Controls.Add(Column);
          AssignPlaceHolder.Controls.Add(AddMachModelHeader());
          AssignPlaceHolder.Controls.Add(endRow);
      }
  </code></pre>
  
  <p>NOTE: AssignPlaceHolder just puts the given item into the page. The code for that is here:</p>
  
  <pre><code>        public PlaceHolder AssignPlaceHolders
      {
          get { return this.AssignPlaceHolder; }
      }
  </code></pre>
  
  <p>So what i am trying to get is something like this.</p>
  
  <blockquote>
    <p>Site  |  Machine Name  |  Machine Type  |  Machine Model</p>
  </blockquote>
  
  <p>as the table headers however, this is what i end up getting:</p>
  
  <blockquote>
    <p>SiteMachine NameMachine Type  |  Machine Model</p>
  </blockquote>
  
  <p>Note: the "|" represents the split between columns that you should get in the table.</p>
  
  <p>As you can see it will only split it up into the two columns. What exactly am i doing wrong and how can i fix this?</p>
  
  <p>Note: I know i can hard code this part, but by figuring out how to get this part to work in this manner i will then be able to fix the problem i am having with the dynamic section of my table that has the amount of items fed into it determined by the amount of machines stored in the database which has the same thing happening to it as well.</p>
  
  <p><strong>Update1</strong>
  as per request</p>
  
  <pre><code>        private Label AddSiteHeader()
      {
          Label label = new Label();
          label.ForeColor = System.Drawing.Color.DarkBlue;
          label.Text = "Site ";
          return label;
      }
  </code></pre>
  
  <p>All those methods do is create a label and populate the text for it.</p>