title: ASP.NET + GridView + EmptyDataTemplate
body: <p>I have an ASP.NET GridView that uses an EmptyDataTemplate. This template is used to collect data in the event that no records exist in my data source. My GridView source looks like this:</p>
  
  <pre><code>&lt;asp:GridView ID="myGridView" runat="server" 
    DataKeyNames="ID" OnRowEditing="myGridView_RowEditing" 
    OnRowCancelingEdit="myGridView_RowCancelingEdit"   
    OnRowUpdating="myGridView_RowUpdating"                            
    ShowFooter="True" EnableModelValidation="True"&gt;
    &lt;Columns&gt;
      &lt;asp:BoundField DataField="ID" Visible="false" /&gt;
      &lt;asp:TemplateField HeaderText="Name"&gt;
        &lt;EditItemTemplate&gt;
          &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:TextBox&gt;
        &lt;/EditItemTemplate&gt;
        &lt;ItemTemplate&gt;
          &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:Label&gt;
        &lt;/ItemTemplate&gt;
        &lt;FooterTemplate&gt;
          &lt;asp:TextBox ID="nameFooterTextBox" runat="server" /&gt;
        &lt;/FooterTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:TemplateField HeaderText="Age"&gt;
      &lt;EditItemTemplate&gt;
        &lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# Bind("Age") %&gt;' /&gt;
      &lt;/EditItemTemplate&gt;
      &lt;ItemTemplate&gt;
        &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("Age") %&gt;' /&gt;
      &lt;/ItemTemplate&gt;
      &lt;FooterTemplate&gt;
        &lt;asp:TextBox ID="ageTextBox" runat="server" /&gt;
      &lt;/FooterTemplate&gt;
    &lt;/asp:TemplateField&gt;
    &lt;asp:CommandField HeaderText="Options" HeaderStyle-HorizontalAlign="Left" 
      ButtonType="Link" ShowEditButton="true" ShowDeleteButton="true" &gt;
    &lt;/asp:CommandField&gt;
  &lt;/Columns&gt;
  
  &lt;EmptyDataTemplate&gt;
    &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
      &lt;tr&gt;
        &lt;td&gt;Name&lt;/td&gt;
        &lt;td&gt;Age&lt;/td&gt;
        &lt;td&gt;Options&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;asp:TextBox ID="nameTextBox" runat="server" /&gt;&lt;/td&gt;
        &lt;td&gt;&lt;asp:TextBox ID="ageTextBox" runat="server" /&gt;&lt;/td&gt;
        &lt;td&gt;&lt;asp:LinkButton ID="saveLinkButton" runat="server" Text="save" OnClick="saveLinkButton_Click" /&gt;&lt;/td&gt; 
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/EmptyDataTemplate&gt;                                                    
  </code></pre>
  
  <p>  </p>
  
  <p>When a user clicks the "saveLinkButton" in the EmptyDataTemplate, I want to get the values from the TextBoxes and insert a new record into my data source. My question is, how do I get the values of those text fields when somebody clicks the "saveLinkButton"?</p>
  
  <p>Thank you!</p>