How filter on multi values

5 posts, 0 answers
  1. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 13 Mar 2014 Link to this post

    Hi,

    I'm trying to add a look up to a multi column combo, which has 2 columns, e.g. Name, Age.

    I added a filter descriptor as per you documentation, which works fine when the user types in a value "Bob" for example, drop down works fine.

    But what I'm trying to do programmatically is:

    MyString = "Bob , Fred, Sam";

    MyMultiColComboBox.Text = myString;

    I was hoping at this stage the drop down would open filters on the 3 names in my string, but I cannot get it to work.

    Is this possible or does the control only filter on a single value.

    Thanks for your help.

    Cheers

    Shaun








  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 18 Mar 2014 Link to this post

    Hi Shaun,

    Thank you for writing.

    For this case you should use a CompositeFilterDescriptor which provides the desired functionality. For example you can create one like this: 
    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo,"Bob"));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, "Sam"));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, "Janet"));
    compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
     
    this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.FilterDescriptors.Add(compositeFilter);

    Let me know if you have additional questions.
     
    Regards,
    Dimitar
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 19 Mar 2014 in reply to Dimitar Link to this post

    Hi Dimitar,

    Thanks for getting back to me, I tried your solution but it does not seem to be working, when I enter a search string which triggers the below code nothing seems to happen. When I click on the multi col box drop down it crashed the application.

    Here's my code: Note I tried it with both
    this.ddVineyards1.MultiColumnComboBoxElement.EditorControl.FilterDescriptors
    and
    this.ddVineyards1.EditorControl.FilterDescriptors


    ​ private void radTextBox3_TextChanged_1(object sender, EventArgs e)
    {
    string Filter = GetVineyardByBlockName(tbNameSearch.Text);
    string[] words = Filter.Split(',');

    this.ddVineyards1.EditorControl.FilterDescriptors.Clear();

    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    foreach (string word in words)
    {
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, word));
    }
    compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
    this.ddVineyards1.EditorControl.FilterDescriptors.Add(compositeFilter);
    this.ddVineyards1.DropDownStyle = RadDropDownStyle.DropDown;
    }

    Any suggestions?

    Thanks

    Shaun.

  5. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 19 Mar 2014 in reply to Dimitar Link to this post

    Note to self: coffee before coding......

    Ignore my last message, my column name was incorrect which produced the error.

    It's almost working, the drop down is not firing, but the filtering seems good..

    Cheers

    Shaun.
  6. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 20 Mar 2014 Link to this post

    Hello Shaun,

    Thank you for writing back.

    I am glad that you have found a solution for your case. If you have any questions, please do not hesitate to contact us.

    Regards,
    Dimitar
    Telerik

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

Back to Top
UI for WinForms is Visual Studio 2017 Ready