title: Unable to persist data in GridView
body: <p>have a <code>GridView</code> but cannot retrieve any of the data on post-back. I have set a break point at the start of <code>Page_Init</code> and <code>Page_Load</code>, on any post-back that is triggered the <code>GridView.Rows.Count</code> property is always 0. The GridView is defined as shown below:</p>
  
  <pre><code>        &lt;asp:GridView ID="TestGrid" runat="server" AllowSorting="False" DataKeyNames="ID,stock,percentage"
              OnRowDataBound="GridViewTest_RowDataBound" EnableViewState="True" 
              OnRowUpdating="GridViewTest_OnRowUpdating" OnRowEditing="GridViewTest_OnRowEditing" OnRowCancelingEdit="GridViewTest_OnRowCancelingEdit"
              AutoGenerateColumns="False"&gt;
              &lt;Columns&gt;
                  &lt;asp:CommandField ShowEditButton="True" CausesValidation="False"/&gt;
                  &lt;asp:BoundField DataField="Client" HeaderText="Client" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="Stock" HeaderText="Stock" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="DutyStatus" HeaderText="DutyStatus" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:TemplateField HeaderText="Percentage" InsertVisible="False"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="enhLbl" runat="server"&gt;&lt;%#Eval("Percentage")%&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;EditItemTemplate&gt;
                          &lt;asp:TextBox ID="TbPercentage" runat="server" Text="&lt;%#Bind("Percentage")%&gt;" class="edit-field"&gt;&lt;/asp:TextBox&gt;
                      &lt;/EditItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I have a check for <code>IsPostBack</code> in <code>Page_Load</code> and only bind the GridView to its DataSource if it's not a post-back.
  The only other time it gets re-bound is in the <code>GridViewTest_OnRowEditing</code>, <code>GridViewTest_OnRowUpdating</code> and <code>GridViewTest_OnRowCancelingEdit</code> event handlers.</p>
  
  <p>I am binding the <code>GridView</code> to a <code>DataTable</code> in the following way:</p>
  
  <pre><code>    AGridView.DataSource = DataTableSplitParcels;
      AGridView.DataBind();
      AGridView.EnableViewState = true;
  </code></pre>
  
  <p>I don't know if it makes any difference, but the <code>DataTable</code> is created in code and the rows added within a loop.</p>
  
  <p>Within Page_Load on a post-back I can see the <code>GridView</code> has its <code>DataKeysArrayList</code> property populated with the current values, however with it having no rows I am unable to retrieve any updated values.</p>