title: ASP.Net : DataPager Control always a step behind with paging
body: <p>Take the following example...a page with a <code>ListView</code> and a <code>DataPager</code> used for paging the data of the <code>ListView</code>:</p>
  
  <p><em>Code Behind:</em></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      MyList.DataSource = GetSomeList();
      MyList.DataBind();
  }
  </code></pre>
  
  <p><em>Source:</em></p>
  
  <pre><code>&lt;asp:ListView ID="MyList" runat="server"&gt;
      &lt;% //LayoutTemplate and ItemTemplate removed for the example %&gt;
  &lt;/asp:ListView&gt;
  
  &lt;asp:DataPager ID="ListPager" PagedControlID="MyList" runat="server" PageSize="10"&gt;
      &lt;Fields&gt;
          &lt;asp:NumericPagerField  /&gt;
      &lt;/Fields&gt;
  &lt;/asp:DataPager&gt;
  </code></pre>
  
  <p>The problem with the <code>DataPager</code> is that it is always a step-behind with the binding.</p>
  
  <p>For example, when the page loads it's on page number 1.  Then when you click on page 3, it stays on page 1 after the postback.  Then you click on page 5, and after the postback it finds itself on page 3...and after that you click on page 6, and it finds itself on page 5...and so on and so forth.</p>
  
  <p>Why isn't the paging working as expected?</p>