Filter mulitiple columns

2 posts, 0 answers
  1. Mattias Kristoffersen
    Mattias Kristoffersen avatar
    3 posts
    Member since:
    Dec 2007

    Posted 20 Feb 2013 Link to this post

    Hi!

    I have a case where i want to filter muliple columns with "contains".
    Lets say i have a  textbox with the following value:

    "manual gearbox Volvo"

    I would like to filter all columns that contains either

    manual
    or Gearbox
    or Volvo

    i cant get this to work. Any ideas?


    This is my code:
    if (RadTextBox1.Text != "")
                    {
     
                        
     
                        string[] words = RadTextBox1.Text.Split(' ');
                        foreach (string word in words)
                        {
                            RadListViewContainsFilterExpression expressionFree = new RadListViewContainsFilterExpression("info");
                            RadListViewContainsFilterExpression expressionFree1 = new RadListViewContainsFilterExpression("brand");
                            RadListViewContainsFilterExpression expressionFree2 = new RadListViewContainsFilterExpression("model");
     
                            expressionFree.CurrentValue = word;
                            RadListView1.FilterExpressions.Add(expressionFree);
     
                            expressionFree1.CurrentValue = word;
                            RadListView1.FilterExpressions.Add(expressionFree1);
     
                            expressionFree2.CurrentValue = word;
                            RadListView1.FilterExpressions.Add(expressionFree2);
                        }
     
                    }
                    RadListView1.Rebind();
  2. Mattias Kristoffersen
    Mattias Kristoffersen avatar
    3 posts
    Member since:
    Dec 2007

    Posted 20 Feb 2013 Link to this post

    i think i solved it
    string[] words = RadTextBox1.Text.Split(' ');
                      foreach (string word in words)
                      {
     
                      RadListView1.FilterExpressions.Add(
                         new RadListViewGroupFilterExpression(RadListViewGroupFilterOperator.Or)
                         {
                             Expressions =
                             {
                                 new RadListViewContainsFilterExpression("info"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("brand"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("modeldescription"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("bodytype"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("city"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("color"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("regno"){CurrentValue  =  word},
                                 new RadListViewContainsFilterExpression("model"){CurrentValue  =  word}    
                             }
                         }
                     );
                     }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top