title: Cannot Sort GridView after using DataBind()
body: <p>I have a <code>GridView</code> that already fetches some data from a <code>SqlDataSource</code>.</p>
  
  <p>The <code>GridView</code> has <strong>sorting</strong>, <strong>paging</strong>, <strong>selection</strong> allowed.</p>
  
  <p>Now when I'm clicking a <code>button</code>, I'm creating a new <code>DataSource</code> with a new Query, and I'm assigning the new <code>DataSource</code> to this Grid, then I use <code>.DataBind()</code> to update this grid, but after that, I cannot sort any column.</p>
  
  <p><strong>Dynamically Creating the new DataSource</strong></p>
  
  <pre><code>SqlDataSource data = new SqlDataSource();
  data.ConnectionString = SqlDataSource1.ConnectionString;
  data.ProviderName = SqlDataSource1.ProviderName;
  data.SelectCommand = "SELECT * FROM USERS";
  GridView2.DataSourceID = "";
  GridView2.DataSource = data;
  GridView2.DataBind();
  </code></pre>
  
  <p>I tried to use the following:</p>
  
  <pre><code>GridView2.AllowSorting = true;
  </code></pre>
  
  <p>Still it didn't work, this is the error I get.</p>
  
  <p><img src="https://i.stack.imgur.com/q60nc.png" alt="enter image description here"></p>
  
  <p>What am I missing here?</p>