title: ASP.NET gridview does not allow me to click on column header texts so I can sort the data
body: <p>I'm just trying to allow the user to sort the GridView by any of the columns of it.</p>
  
  <pre><code>&lt;asp:GridView ID="gvShows" runat="server" DataKeyNames="dataSource,title" Caption="Show List" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" CaptionAlign="Left" OnSorting="gvShows_Sorting" &gt;
                      &lt;RowStyle BorderColor="Black" /&gt;
                      &lt;Columns&gt; 
                          &lt;asp:TemplateField HeaderText="Select"&gt; 
                              &lt;ItemTemplate&gt; 
                                  &lt;asp:CheckBox ID="cbSelect" runat="server" AutoPostBack="false"/&gt; 
                              &lt;/ItemTemplate&gt; 
                          &lt;/asp:TemplateField&gt; 
                          &lt;asp:BoundField HeaderText="Data Source" DataField="dataSource" /&gt; 
                          &lt;asp:BoundField HeaderText="Show ID" DataField="ShowId" /&gt; 
                          &lt;asp:BoundField HeaderText="Show Title" DataField="title" /&gt; 
                          &lt;asp:BoundField HeaderText="Episode Id" DataField="EpisodeID" /&gt; 
                          &lt;asp:BoundField HeaderText="Episode Title" DataField="EpisodeTitle" /&gt; 
                          &lt;asp:BoundField HeaderText="Genre" DataField="Genre" /&gt; 
                          &lt;asp:BoundField HeaderText="Show Type Description" DataField="ShowTypeDescription" /&gt; 
                          &lt;asp:BoundField HeaderText="Director Name" DataField="DirectorName" /&gt; 
                          &lt;asp:BoundField HeaderText="Release Year" DataField="ReleaseYear" /&gt; 
                          &lt;asp:BoundField HeaderText="Season Episode" DataField="SeasonEpisode" /&gt; 
                      &lt;/Columns&gt;  
                  &lt;/asp:GridView&gt;
  
      protected void gvShows_Sorting(object sender, GridViewSortEventArgs e)
      {
          var dataTable = Session["shows"] as DataTable;
  
          if (dataTable != null)
          {
              var dataView = new DataView(dataTable)
                  {
                      Sort = e.SortExpression + " " + ConvertSortDirection(e.SortDirection)
                  };
  
              gvShows.DataSource = dataView;
              gvShows.DataBind();
          }
      }
  
      private string ConvertSortDirection(SortDirection sortDirection)
      {
          string newSortDirection = String.Empty;
  
          switch (sortDirection)
          {
              case SortDirection.Ascending:
                  newSortDirection = "ASC";
                  break;
  
              case SortDirection.Descending:
                  newSortDirection = "DESC";
                  break;
          }
  
          return newSortDirection;
      }
  </code></pre>
  
  <p>When data is displayed in the GridView, I'm simply not allowed to click on the header text so that I can sort the data:</p>
  
  <p><img src="https://i.imgur.com/Dydmv1o.png"></p>