title: control Gridview Based on Selection of more than one Drop down List
body: <p>I created a data base named as Ztv.mdf , table as tabl1 with [Name], [fullname], [Id],[dept]&amp; also
  created a drop down list1 for dept.when the dept values selected by user from dropdown list1 the gridview shows the output.it works fine.But i want 1 more dropdown list for Name.my aim is that when user select values from both dropdownlist1 &amp; dropdown list2 it contol the grid view.how can i do it? </p>
  
  <p>my code for 1 dropdown list &amp; grid view is: </p>
  
  
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
      &lt;asp:DropDownList ID="ddlSearchCriteria" runat="server" 
          DataSourceID="SqlDataSource1" DataTextField="depat" DataValueField="Id" 
          AutoPostBack="True"&gt;
      &lt;/asp:DropDownList&gt;
      &amp;nbsp;&amp;nbsp;
         &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:ztvConnectionString %&gt;" 
          SelectCommand="SELECT [Id], [depat] FROM [Table1]"&gt;&lt;/asp:SqlDataSource&gt;
      &lt;br /&gt;
  
      &lt;asp:GridView ID="gvSearchResults" runat="server" AutoGenerateColumns="False" 
          DataKeyNames="Id" DataSourceID="SqlDataSource2" CellPadding="4" 
          ForeColor="#333333" GridLines="None" style="margin-left: 155px"&gt;
          &lt;AlternatingRowStyle BackColor="White" /&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
              &lt;asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                  ReadOnly="True" SortExpression="Id" /&gt;
              &lt;asp:BoundField DataField="fullname" HeaderText="fullname" 
                  SortExpression="fullname" /&gt;
          &lt;/Columns&gt;
          &lt;EditRowStyle BackColor="#2461BF" /&gt;
          &lt;FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#EFF3FB" /&gt;
          &lt;SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /&gt;
          &lt;SortedAscendingCellStyle BackColor="#F5F7FB" /&gt;
          &lt;SortedAscendingHeaderStyle BackColor="#6D95E1" /&gt;
          &lt;SortedDescendingCellStyle BackColor="#E9EBEF" /&gt;
          &lt;SortedDescendingHeaderStyle BackColor="#4870BE" /&gt;
      &lt;/asp:GridView&gt;
      &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:ztvConnectionString %&gt;" 
  
          SelectCommand="SELECT [Name], [fullname], [Id] FROM [Table1] WHERE ([Id] = @Id)"&gt;
          &lt;SelectParameters&gt;
              &lt;asp:ControlParameter ControlID="ddlSearchCriteria" Name="Id" 
                  PropertyName="SelectedValue" Type="Int32" /&gt;
          &lt;/SelectParameters&gt;
      &lt;/asp:SqlDataSource&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
  
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>