title: Rows.Count with dropdown list
body: <p>Using .net 4 and c# I'm trying to get data from database into GridView and display the number of rows returned. I also have a dropdown list used as ControlParameters in SqlDataSource to filter results.</p>
  
  <p>This works fine on initial page load, but when I select something from the dropdown the results are filtered, but rows count doesn't change. When I select another item from the dropdown, the rows count gets updated but with the number correct for the previous value. </p>
  
  <pre><code>        &lt;h5&gt; Showing &lt;asp:Label ID="WOs_count" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; Work Orders.&lt;/h5&gt;  
  
          &lt;asp:DropDownList 
              ID="DropDownList1" 
              runat="server" 
              AutoPostBack="True"&gt;
              &lt;asp:ListItem Value="%"&gt;All requests&lt;/asp:ListItem&gt;
              &lt;asp:ListItem Value="BBTeam"&gt;BB Team&lt;/asp:ListItem&gt;
          &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>The Select statement:</p>
  
  <pre><code> &lt;asp:SqlDataSource 
      ID="WorkList" 
      runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" 
      SelectCommand="SELECT TASKS.WOID AS wo_id, Tasks.Completed AS 'Completed Date', Tasks.Respons AS 'Technician', FROM Tasks WHERE (Tasks.Completed&gt;=DATEADD(day,-60,GETDATE())OR Tasks.Completed IS NULL)  AND (Tasks.Respons LIKE @Respons)  "&gt;
      &lt;SelectParameters&gt;
          &lt;asp:ControlParameter name="Respons" ControlID="DropDownList1" PropertyName="SelectedValue"/&gt;
      &lt;/SelectParameters&gt;
  
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Then in the code behind I have this:</p>
  
  <pre><code>        protected void Page_Load(object sender, EventArgs e)
      {
  
          WOs_count.Text = WO_list.Rows.Count.ToString();
      }
  </code></pre>
  
  <p>I'm completely new to .net so wouldn't be surprised if I miss something obvious.</p>