title: How can I filter a gridview when two columns in the datasource match
body: <p>I have a GridView where the datasource is set from a Datatable filled from a Stored Procedure. There are two columns in the datatable that I am interested in filtering/showing &amp; hiding based on their content.
  The data is for lessons for different courses.</p>
  <p>DataTable/Datasource</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Identifier</th>
  <th>Lesson Title</th>
  <th>BaseIdentifier</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>CBT-0001</td>
  <td>How to Build a Cabinet</td>
  <td>CBT-0001</td>
  </tr>
  <tr>
  <td>CBT-0002</td>
  <td>Dangers of Cutting Lumber</td>
  <td>CBT-0002</td>
  </tr>
  <tr>
  <td>TBL-0001</td>
  <td>How to Build a Table</td>
  <td>TBL-0001</td>
  </tr>
  <tr>
  <td>TBL-0002</td>
  <td>Dangers of Cutting Lumber</td>
  <td>CBT-0002</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>In the above table the Lesson TBL-0002 is just a alias/ pointer to CBT-0002.</p>
  <p>Based on a checkbox I need to show everything in the Gridview and I need to just show the parent lessons the ones where the identifier = baseIdentifier. So after filtering / or hiding rows my gridview would look like this:</p>
  <p>[ ] Show Alias Lessons</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Identifier</th>
  <th>Lesson Title</th>
  <th>BaseIdentifier</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>CBT-0001</td>
  <td>How to Build a Cabinet</td>
  <td>CBT-0001</td>
  </tr>
  <tr>
  <td>CBT-0002</td>
  <td>Dangers of Cutting Lumber</td>
  <td>CBT-0002</td>
  </tr>
  <tr>
  <td>TBL-0001</td>
  <td>How to Build a Table</td>
  <td>TBL-0001</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>[X] Show Alias Lessons</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Identifier</th>
  <th>Lesson Title</th>
  <th>BaseIdentifier</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>CBT-0001</td>
  <td>How to Build a Cabinet</td>
  <td>CBT-0001</td>
  </tr>
  <tr>
  <td>CBT-0002</td>
  <td>Dangers of Cutting Lumber</td>
  <td>CBT-0002</td>
  </tr>
  <tr>
  <td>TBL-0001</td>
  <td>How to Build a Table</td>
  <td>TBL-0001</td>
  </tr>
  <tr>
  <td>TBL-0002</td>
  <td>Dangers of Cutting Lumber</td>
  <td>CBT-0002</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>My goal is to only query once rather than having to requery every time the checkbox is Checked/unchecked.
  The only time an Identifier will equal a BaseIdentifier is when it is the parent lesson (Parents are Aliases of themselves).</p>
  <p>My Code:</p>
  <pre><code>            PathBO pathBO = new PathBO();
              LessonBO lessonBO = new LessonBO();
              pathBO.GetPath();
              DataTable dt = new DataTable();
              dt = lessonBO.GetAllAliasLessons();
              gvLessons.DataSource = dt;
              gvLessons.DataBind();
  </code></pre>
  <p>My Gridview:</p>
  <pre><code>        &lt;asp:GridView ID=&quot;gvLessons&quot; runat=&quot;server&quot; cssClass=&quot;Grid&quot; GridLines=&quot;None&quot; AutoGenerateColumns=&quot;False&quot; AllowSorting=&quot;true&quot;&gt;
              &lt;AlternatingRowStyle cssClass=&quot;GridAltRow&quot; /&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField=&quot;Identifier&quot; HeaderText=&quot;Identifier&quot; SortExpression=&quot;Identifier&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;SectionTitle&quot; HeaderText=&quot;SectionTitle&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;VersionNum&quot; HeaderText=&quot;VersionNumber&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;AliasList&quot; HeaderText=&quot;AliasList&quot; /&gt;
                  &lt;asp:BoundField DataField=&quot;BaseIdentifier&quot; HeaderText=&quot;BaseIdentifier&quot; Visible=&quot;False&quot; /&gt;
              &lt;/Columns&gt;
              &lt;EditRowStyle cssClass=&quot;GridEditRow&quot; /&gt;
              &lt;FooterStyle cssClass=&quot;GridFooter&quot; /&gt;
              &lt;HeaderStyle cssClass=&quot;GridHeader&quot; /&gt;
              &lt;PagerStyle cssClass=&quot;GridPager&quot; /&gt;
              &lt;RowStyle cssClass=&quot;GridRow&quot; /&gt;
              &lt;SelectedRowStyle cssClass=&quot;GridSelectedRow&quot; /&gt;
              &lt;SortedAscendingCellStyle cssClass=&quot;GridSortAscCell&quot; /&gt;
              &lt;SortedAscendingHeaderStyle cssClass=&quot;GridSortAscHeader&quot; /&gt;
              &lt;SortedDescendingCellStyle cssClass=&quot;GridSortDescCell&quot; /&gt;
              &lt;SortedDescendingHeaderStyle cssClass=&quot;GridSortDescHeader&quot; /&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  <p>Thanks</p>