title: Working with ASP.Net GridView sorting and paging
body: <p>We set up an ASP.Net GridView and included sorting and paging. When the user clicks on the GridView column header links for sorting the data or if the user clicks on the numbers links at the bottom of the GridView for paging the data, nothing happens.</p>
  
  <p>Here is a cut down version of the markup for the GridView:</p>
  
  <pre><code>&lt;asp:UpdatePanel 
      ID="UpdatePanelSummary" 
      runat="server" 
      UpdateMode="Always"&gt;
  
      &lt;ContentTemplate&gt; 
  
          &lt;h1&gt;Maintenance&lt;/h1&gt;
  
          &lt;% '-- GridView (Grid) for summary.                                                      -- %&gt;
          &lt;% '-- The user chooses a summary row from here and details are shown in a DetailsView.  -- %&gt;
          &lt;% '--------------------------------------------------------------------------------------- %&gt;
  
          &lt;asp:GridView
              ID="GridViewSummary" 
              runat="server" 
              AllowSorting="True" 
              AutoGenerateColumns="False" 
              DataKeyNames="ID" 
              Width="224px" 
              AllowPaging="True" 
              PageSize="7"&gt;
  
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField="Unit" HeaderText="Unit" 
                      SortExpression="Unit" /&gt;
  
                  &lt;asp:BoundField DataField="TheName" HeaderText="Name" 
                      SortExpression="TheName" /&gt;
  
                  &lt;asp:BoundField DataField="ID" 
                      HeaderText="ID" SortExpression="ID" InsertVisible="False" ReadOnly="True" 
                      Visible="False" /&gt;
  
                  &lt;asp:CommandField ButtonType="Button" SelectText="Select Unit Details" 
                      ShowSelectButton="True" /&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Since nothing is happening, we are assuming we need to write some coding in the code-behind file. Can you show us what coding is needed to wake up the sorting and paging?</p>