title: Getting the values of a dynamically created control inside Telerik:RadGrid
body: <p>I have a telerik RadGrid to which I am adding columns dynamically on click of a button. The Code is as follows : </p>
  
  <pre><code> private void AddColumns()
      {
          try
          {
              DataTable dtParMaintenanceListHeaderData = (DataTable)Session["ParMaintenanceListHeaderData"];
              foreach (DataColumn dc in dtParMaintenanceListHeaderData.Columns)
              {
                  dc.ReadOnly = false;
              }
              if (!dtParMaintenanceListHeaderData.Columns.Contains("parComboDataField"))
                  dtParMaintenanceListHeaderData.Columns.Add("parComboDataField", typeof(string));
              dtParMaintenanceListHeaderData.AcceptChanges();
              foreach (DataRow drEachRow in dtParMaintenanceListHeaderData.Rows)
              {
                  string cusCombo = drEachRow["cusfstnam"].ToString() + " - " + drEachRow["cuslstnam"].ToString();
                  string parCombo = drEachRow["parcod"].ToString() + " - " + drEachRow["pardsc"].ToString();
                  drEachRow["parComboDataField"] = cusCombo + " " + parCombo;
                  GridTemplateColumn templateColumn = new GridTemplateColumn();
                  string templateColumnName = cusCombo + " - " + parCombo;
                  templateColumn.ItemTemplate = new RadGridTemplate(templateColumnName);
                  templateColumn.HeaderText = templateColumnName;
                  templateColumn.DataField = "parqty";
                  templateColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                  templateColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                  templateColumn.HeaderStyle.Width = Unit.Pixel(60);
                  templateColumn.HeaderStyle.Wrap = true;
  
                  this.radgridParListItems.MasterTableView.Columns.Add(templateColumn);
  
  
              }
          }
          catch (Exception Ex)
          {
  
  
          }
      }
  </code></pre>
  
  <p>The above method is called on click of a button. </p>
  
  <p>In each of the columns added I am adding a textbox as follows : </p>
  
  <pre><code>#region Namespaces used
  using System;
  using System.Web;
  using System.Collections.Generic;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data;
  using Telerik.Web.UI;
  #endregion
  
  /// &lt;summary&gt;
  /// Summary description for RadGridTemplate
  /// &lt;/summary&gt;
  public class RadGridTemplate : ITemplate
  {
      protected LiteralControl lControl;
      protected TextBox textBox;
      private string colname;
      public RadGridTemplate(string cName)
      {
          colname = cName;
      }
      public void InstantiateIn(System.Web.UI.Control container)
      {
  
          textBox = new TextBox();
          textBox.ID = container.ID + "txtParQty";
          textBox.Width = Unit.Pixel(50);
          container.Controls.Add(textBox);
           textBox.Text = HttpContext.Current.Request.Form[textBox.UniqueID];
      }
  
  
  
  }
  </code></pre>
  
  <p>Now there is another button,"Save" which when clicked upon will have to fetch the data from all the textboxes in the dynamically added controls. The trouble is :</p>
  
  <p>On post back all the controls are cleared and re-created so their values are null.</p>
  
  <p>How do I capture the values of all the textboxes in a row.</p>