title: How to get value from TemplateField in GridView using asp.net C#?
body: <p>I am trying to retrieve the data entered into a Gridview Textbox, but I am getting no data from that. Here is my code:</p>
  
  <p>in ASP</p>
  
  <pre><code>&lt;asp:GridView ID="Add" runat="server"&gt;
      &lt;Columns&gt;
           &lt;asp:TemplateField HeaderText="Select" HeaderStyle-Width="100px"&gt;
                 &lt;ItemTemplate&gt;
                       &lt;asp:CheckBox ID="cbox_Select" runat="server" /&gt;
                 &lt;/ItemTemplate&gt;
           &lt;/asp:TemplateField&gt;
           &lt;asp:BoundField DataField = "Name" HeaderText = "Fee Type" /&gt;
           &lt;asp:TemplateField HeaderText="Amount" HeaderStyle-Width="100px"&gt;
                 &lt;ItemTemplate&gt;
                       &lt;asp:TextBox ID="TextBox" runat="server"&gt;&lt;/asp:TextBox&gt;
                 &lt;/ItemTemplate&gt;
           &lt;/asp:TemplateField&gt;
       &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>and in C#,</p>
  
  <pre><code>for (int i = 0; i&lt; n;i++)
  {
        string a = ((TextBox)Add.Rows[i].Cells[2].FindControl("TextBox")).Text;
  }
  </code></pre>
  
  <p>Can anyone help me with this?</p>