title: How to make gridview searchable?
body: <p>I've got a gridview that draws from multiple tables, I'd like to make it searchable in three fields, one from each table. I plan on using a dropdown to select which field to search for, and a textbox of course for search input, but what then? Here's my gridview code in C# ASP.NET:</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
      EmptyDataText="There are no data records to display." AllowPaging="True" 
      BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
      CellPadding="3" GridLines="Vertical" HorizontalAlign="Center" 
      DataKeyNames="SubId" AllowSorting="True"&gt;
      &lt;AlternatingRowStyle BackColor="#DCDCDC" /&gt;
  
      &lt;Columns&gt;
  
          &lt;asp:BoundField DataField="SubId" HeaderText="Submission ID" 
              SortExpression="SubId" &gt;
          &lt;ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" /&gt;
          &lt;/asp:BoundField&gt;
          &lt;asp:BoundField DataField="CustName" HeaderText="Customer" 
              SortExpression="CustName" /&gt;
          &lt;asp:BoundField DataField="CustCity" HeaderText="Customer City" 
              SortExpression="CustCity" /&gt;
          &lt;asp:BoundField DataField="CustState" HeaderText="Customer State" 
              SortExpression="CustState" /&gt;
          &lt;asp:BoundField DataField="BroName" HeaderText="Broker " 
              SortExpression="BroName" /&gt;
          &lt;asp:BoundField DataField="BroState" HeaderText="Broker State" 
              SortExpression="BroState" /&gt;
          &lt;asp:BoundField DataField="EntityType" HeaderText="EntityType" 
              SortExpression="EntityType" /&gt;
          &lt;asp:BoundField DataField="Coverage" DataFormatString="{0:c}" 
              HeaderText="Coverage" SortExpression="Coverage" /&gt;
          &lt;asp:BoundField DataField="Status" HeaderText="Status" 
              SortExpression="Status" /&gt;
  
          &lt;asp:HyperLinkField DataNavigateUrlFields="SubId" 
              DataNavigateUrlFormatString="View.aspx?SubId={0}" Text="View" /&gt;
          &lt;asp:HyperLinkField DataNavigateUrlFields="SubId" 
              DataNavigateUrlFormatString="ViewEdit.aspx?SubId={0}" Text="Edit" /&gt;
  
      &lt;/Columns&gt;
      &lt;FooterStyle BackColor="#CCCCCC" ForeColor="Black" /&gt;
      &lt;HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /&gt;
      &lt;RowStyle BackColor="#EEEEEE" ForeColor="Black" /&gt;
      &lt;SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /&gt;
      &lt;SortedAscendingCellStyle BackColor="#F1F1F1" /&gt;
      &lt;SortedAscendingHeaderStyle BackColor="#0000A9" /&gt;
      &lt;SortedDescendingCellStyle BackColor="#CAC9C9" /&gt;
      &lt;SortedDescendingHeaderStyle BackColor="#000065" /&gt;
  &lt;/asp:GridView&gt;
  &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:MyConnectionString %&gt;" 
      ProviderName="&lt;%$ ConnectionStrings:ProductInstanceString.ProviderName %&gt;" 
  
  
      SelectCommand="SELECT Customer.SubId, Customer.CustName, Customer.CustCity, Customer.CustState, Broker.BroName, Broker.BroState, Broker.EntityType, Submission.Coverage, Submission.Status FROM Submission INNER JOIN Broker ON Broker.SubId = Submission.SubmissionId INNER JOIN Customer ON Customer.SubId = Submission.SubmissionId"&gt;
  
  &lt;/asp:SqlDataSource&gt;
  </code></pre>