title: multiple search textboxes in asp.net
body: <p>i have multiple text-boxes and one drop-down list in my system and i'm using the Query builder to select the data from multiple tables in the database (SQL server), and display them in the grid view </p>
  
  <p>Suggestion ID : (textbox)
  Staff ID: (textbox)
  Status: (drop down list)
  Staff Name: (textbox)</p>
  
  <p>..............................</p>
  
  <p>I want the searching result to work by entering one field or  multiple fields. 
  the problem is, when i browse in the  internet to test if the queries worked or not, i find that it works only by entering all the fields.</p>
  
  <p>this is the Query generated in the query builder (Visual studio 2010)</p>
  
  <pre><code>SELECT
  SuggestionDetail.SuggestionDescription, SuggestionDetail.SuggestionID,
  SuggestionDetail.DateOfSubmission, Employee.EmployeeID, Employee.City,
  Employee.EmployeeName, Category.CategoryName, SuggestionStatusDetail.DateOfLastUpdate,
  SuggestionStatus.StatusName
  
  FROM
  Employee
  
  INNER JOIN
  SuggestionDetail
  
  ON
  Employee.EmployeeID = SuggestionDetail.EmployeeID
  
  INNER JOIN
  Category
  
  ON
  SuggestionDetail.CategoryID = Category.CategoryID
  
  INNER JOIN
  SuggestionStatusDetail
  
  ON
  SuggestionDetail.SuggestionID = SuggestionStatusDetail.SuggestionID
  
  INNER JOIN
  SuggestionStatus
  
  ON
  SuggestionStatusDetail.StatusID = SuggestionStatus.StatusID
  
  WHERE
  (Employee.EmployeeName LIKE N'%' + @empname + N'%')
  OR
  (Employee.EmployeeID LIKE '%' + @empid + '%')
  OR
  (SuggestionDetail.SuggestionID LIKE '%' + @txtDocID + '%')
  OR
  (SuggestionStatus.StatusName LIKE N'%' + @StatusName + N'%')
  </code></pre>
  
  <p>And this the code generated inside the HTML :</p>
  
  <pre><code>     &lt;asp:GridView ID="GridView1" runat="server" BackColor="White" class="GridView"
           BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
           EnableModelValidation="True" ForeColor="Black" GridLines="Vertical" 
           AutoGenerateColumns="False" 
           DataSourceID="SqlDataSource2"&gt;
           &lt;AlternatingRowStyle BackColor="White" /&gt;
           &lt;Columns&gt;
               &lt;asp:BoundField DataField="SuggestionDescription" HeaderText="SuggestionDescription" 
                   SortExpression="SuggestionDescription" /&gt;
               &lt;asp:BoundField DataField="SuugestionID" HeaderText="SuggestionID" 
                   InsertVisible="False" ReadOnly="True" SortExpression="SuggestionID" /&gt;
               &lt;asp:BoundField DataField="DateOfSubmission" HeaderText="DateOfSubmission" 
                   SortExpression="DateOfSubmission" /&gt;
               &lt;asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                   SortExpression="EmployeeID" /&gt;
               &lt;asp:BoundField DataField="City" HeaderText="City" SortExpression="City" /&gt;
               &lt;asp:BoundField DataField="EmployeeName" HeaderText="EmployeeName" 
                   SortExpression="EmployeeName" /&gt;
               &lt;asp:BoundField DataField="CategoryName" HeaderText="CategoryName" 
                   SortExpression="CategoryName" /&gt;
               &lt;asp:BoundField DataField="DateOfLastUpdate" HeaderText="DateOfLastUpdate" 
                   SortExpression="DateOfLastUpdate" /&gt;
               &lt;asp:BoundField DataField="StatusName" HeaderText="StatusName" 
                   SortExpression="StatusName" /&gt;
           &lt;/Columns&gt;
  </code></pre>
  
  <p>any help please, i am still new in visual studio.
               
               
               
               
               
           </p>
  
  <pre><code>     &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" 
           ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" 
  
           SelectCommand="SELECT SuggestionDetail.SuggestionDescription, SuggestionDetail.SuggestionID, SuggestionDetail.DateOfSubmission, Employee.EmployeeID, Employee.City, Employee.EmployeeName, Category.CategoryName, SuggestionStatusDetail.DateOfLastUpdate, SuggestionStatus.StatusName FROM Employee INNER JOIN SuggestionDetail ON Employee.EmployeeID = SuggestionDetail.EmployeeID INNER JOIN Category ON SuggestionDetail.CategoryID = Category.CategoryID INNER JOIN SuggestionStatusDetail ON SuggestionDetail.SuggestionID = SuggestionStatusDetail.SuggestionID INNER JOIN SuggestionStatus ON SuggestionStatusDetail.StatusID = SuggestionStatus.StatusID WHERE (Employee.EmployeeName LIKE N'%' + @empname + N'%') OR (Employee.EmployeeID LIKE '%' + @empid + '%') OR (SuggestionDetail.SuggestionID LIKE '%' + @txtDocID + '%') OR (SuggestionStatus.StatusName LIKE N'%' + @StatusName + N'%')"&gt;
           &lt;SelectParameters&gt;
               &lt;asp:ControlParameter ControlID="txtStaffName" Name="empname" 
                   PropertyName="Text" /&gt;
               &lt;asp:ControlParameter ControlID="txtStaffID" Name="empid" PropertyName="Text" /&gt;
               &lt;asp:ControlParameter ControlID="txtDocID" Name="txtDocID" 
                   PropertyName="Text" /&gt;
               &lt;asp:ControlParameter ControlID="ddStatus" Name="StatusName" 
                   PropertyName="SelectedValue" /&gt;
           &lt;/SelectParameters&gt;
       &lt;/asp:SqlDataSource&gt;
  </code></pre>