title: ASP.NET Datasource Select Command
body: <p>I have a local DB table that is displayed in a <code>GridView</code>. In that table, I have a column called: "Completed".</p>
  
  <p>When I first display the table, I am displaying it without completed records (Completed=false).  Here is the <code>SqlDataSource</code> select command:</p>
  
  <pre><code>"SELECT * FROM [CERecord] WHERE [Completed]='false' ORDER BY [Priority]";
  </code></pre>
  
  <p>I have a checkbox which causes postback. I want to toggle the display of Completed records by ticking / unticking it:</p>
  
  <pre><code>protected void cbShowCompletedRecords_CheckedChanged(object sender, EventArgs e)
      {
          if (cbShowCompletedRecords.Checked)
              CEDatabaseSource.SelectCommand = "SELECT * FROM [CERecord] ORDER BY [Priority]";
          else
          {
              CEDatabaseSource.SelectCommand = "SELECT * FROM [CERecord] WHERE [Completed]='false' ORDER BY [Priority]";
          }
      }
  </code></pre>
  
  <p>Currently, when I check the box, I get all the records.  But when I uncheck it, the <code>GridView</code> doesn't update, even though the code above executes. What I am missing?</p>