title: Access Textbox inside DetailsView
body: <p>Does anyone have any idea how I can set the text of a textbox inside a DetailsView field (c#)?</p>
  
  <p>I've tried a few variations but all return out of context and object reference not set errors.</p>
  
  <p>Heres my code...</p>
  
  <p>ASPX:</p>
  
  <pre><code>&lt;asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"&gt;
      &lt;Fields&gt;
          &lt;asp:TemplateField HeaderText="Header Text"&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox1" runat="server" Text="test"&gt;&lt;/asp:TextBox&gt;
              &lt;/InsertItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Fields&gt;
  &lt;/asp:DetailsView&gt;
  </code></pre>
  
  <p>CS:</p>
  
  <pre><code>TextBox txt = (TextBox)DetailsView1.FindControl("TextBox1");
  txt.Text = "Text ";
  </code></pre>
  
  <p>Cheers</p>