title: GridView Paging and Sorting
body: <p>I have a GridView webcontrol that has paging and sorting enabled. I've bound the datasource to an SqlDataSource. When I try to change the page index or sort, I get a "GridView fired event [Sorting/PageIndexChanging] which wasn't handled" error. Isn't the SqlDataSource already equipeed to handle these events?</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@language = "C#" Debug="true" src="ServerCode/Default.cs" Inherits="Home.Default" %&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;APTEIT Data Preview&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id = "mainFrm" runat = "server"&gt;
          &lt;div id = "headersDiv"&gt;
              &lt;asp:Table id = "headerTbl" runat = "server"&gt;
              &lt;/asp:Table&gt;
          &lt;/div&gt;
          &lt;div id = "dataDiv"&gt;
              &lt;asp:GridView id = "dataTbl" runat = "server" 
                  ShowHeader="false"
                  AllowPaging="true"
                  GridLines="None" 
                  AlternatingRowStyle="altRow"
                  PagerStyle="pager"
                  PageSize="50"
                  &gt;
              &lt;/asp:GridView&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>CodeBehind</p>
  
  <pre><code>SqlDataSource sqlData = new SqlDataSource("Hidden for security reasons");
  Select(DataSourceSelectArguments.Empty);
  dataTbl.DataSource = sqlData;
  dataTbl.DataBind();
  headerTbl.Rows.Add(new TableRow());
  </code></pre>