title: Applying filter on paginated page shows empty result
body: <p>I have a problem with paginated pages to apply filter. I have used ListView Control to display data from database &amp; having some filters. Now problem is suppose If I view all products (18 Products per page) &amp; having 187 Products So If I switch to 7th page &amp; then apply price range filter then it find products from that range but showing empty result. This is my live site Link <a href="http://foxboxretail.in/products" rel="nofollow noreferrer">http://foxboxretail.in/products</a> </p>
  
  <p>My Datapager Code</p>
  
  <pre><code>protected void OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
  {
      (products.FindControl("DataPager1") as DataPager).SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
      products.PageIndex = 0;
      buildWhereClause();
  }
  </code></pre>
  
  <p>Filter Applying Code</p>
  
  <pre><code>public string buildWhereClause()
  {
      string pageName = string.Empty;    
      string constr = ConfigurationManager.ConnectionStrings("conio2").ConnectionString;
      string query = "select * from products";
      string joiner = "";
  
      string condition = string.Empty;
      string whereClause = string.Empty;
      string priceCondition = string.Empty;
  
      try {
          for (i = 0; i &lt;= priceFilter.Items.Count - 1; i++) {
              if (priceFilter.Items(i).Selected) {
                  string price = priceFilter.Items(i).ToString;
                  priceCondition = string.Concat(priceCondition, joiner, string.Format("'{0}'", price));
                  if (string.IsNullOrEmpty(joiner))
                      joiner = ",";
              }
          }
  
          joiner = " where ";
          if (!string.IsNullOrEmpty(priceCondition)) {
              whereClause = string.Concat(whereClause, joiner, string.Format("price_range IN ({0})", priceCondition));
              joiner = " and ";
          }
  
  
          string masterClause = string.Empty;
          if (whereClause == string.Empty) {
              masterClause = (query + " Where type = @type and status = @status");
          } else {
              masterClause = (query + whereClause + " and type = @type and status = @status");
          }
  
          using (MySqlConnection con = new MySqlConnection(constr)) {
              using (MySqlCommand cmd = new MySqlCommand(masterClause)) {
                  using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd)) {
                      cmd.Parameters.AddWithValue("@type", "product");
                      cmd.Parameters.AddWithValue("@status", "active");
                      cmd.Connection = con;
                      using (DataTable dt = new DataTable()) {
                          sda.Fill(dt);
                          products.DataSource = dt;
                          products.DataBind();
                          itemCount.Text = dt.Rows.Count.ToString;
                      }
                  }
              }
          }
      } catch (Exception ex) {
          Response.Write(ex);
          return string.Concat(query, whereClause);
      }
  }
  </code></pre>
  
  <p>UPDATE (Snapshot of datapager)
  <a href="https://i.stack.imgur.com/t66gl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t66gl.png" alt="enter image description here"></a></p>