title: How can i insert a label text in a table cell
body: <p>I have a table which i am dynamically generating based on user input. I am trying to insert a label text into table cell on button click. onclick of button a label text of a demo method should be inserted into table cells. Can someone suggest me how can i do this?</p>
  
  <p>Thanks.</p>
  
  <p>Creating Table:</p>
  
  <pre><code>function CreateTable(){
      var rowCtr;
      var cellCtr;
      var rowCnt;
      var cellCnt;
  
      var myTableDiv = document.getElementById('myDynamicTable');
  
      var table = document.createElement('table');
      table.setAttribute("contenteditable", "true");
      table.border = "1";
      table.id = "myTable";
  
  
      var tableBody = document.createElement('tbody');
      table.appendChild(tableBody);
  
      rowCnt = document.getElementById('txtrows').value;
      cellCnt = document.getElementById('txtcols').value;
  
      for (rowCtr = 0; rowCtr &lt; rowCnt; rowCtr++) {
  
          var tr = document.createElement('tr');
          tableBody.appendChild(tr);
  
          for (cellCtr = 0; cellCtr &lt; cellCnt; cellCtr++) {
  
              var td = document.createElement('td');
              td.width = '120';
              td.appendChild(document.createTextNode("Row:" + rowCtr + " Column:" + cellCtr));
              tr.appendChild(td);
          }
      }
      myTableDiv.appendChild(table);
    }
  </code></pre>
  
  <p>Button:</p>
  
  <pre><code>&lt;asp:Button ID="button1" Text="button" runat="server" OnClick="demo" /&gt;
  </code></pre>
  
  <p>C# code:</p>
  
  <pre><code> public void demo()
      {
          TableCell tcell = new TableCell();
          RadLabel rlbl = new RadLabel();
          rlbl.Text = "test";
          tcell.Controls.Add(rlbl);
  
      }
  
      protected void demo(object sender, EventArgs e)
      {
          demo();
      }
  </code></pre>