title: Total row count in GridView control using LinqDataSource and paging
body: <p>I'm having a problem obtaining the total row count for items displayed in a Gridview using Paging and with a LinqDataSource as the source of data.</p>
  
  <p>I've tried several approaches:</p>
  
  <pre><code>protected void GridDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e)  
  {  
      totalLabel.Text = e.TotalRowCount.ToString();  
  }
  </code></pre>
  
  <p>returns -1 every time.</p>
  
  <pre><code>protected void LinqDataSource1_Selected(object sender, LinqDataSourceStatusEventArgs e)  
  {  
      System.Collections.Generic.List&lt;country&gt; lst  = e.Result as System.Collections.Generic.List&lt;country&gt;;  
      int count = lst.Count;  
  }
  </code></pre>
  
  <p>only gives me the count for the current page, and not the total.</p>
  
  <p>Any other suggestions?</p>