Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > MultiColumn ComboBox > MultiColumnCombo Filtering

Not answered MultiColumnCombo Filtering

Feed from this thread
  • Mukesh Kapoor avatar

    Posted on Jan 10, 2010 (permalink)

    Hi,

    Is there any way we can have multiple columns based filtering in MultiColumnCombo...

    Example:

    RadMultiColumnComboBoxElement

     

    multiColumnComboElement = this.mcboSample.MultiColumnComboBoxElement;

     

    multiColumnComboElement.EditorControl.MasterGridViewTemplate.AutoGenerateColumns =

    false;

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("Code"));

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("RealName"));

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("NickName"));

     

    multiColumnComboElement.Rows.Add(

    "1011", "Paul Wight, Jr.", "Big Show");

     

    multiColumnComboElement.Rows.Add(

    "1022", "Carlos Colón, Jr.", "Carlito");

     

    multiColumnComboElement.Rows.Add(

    "2031", "Matthew Korklan", "Evan Bourne");

     

    multiColumnComboElement.Rows.Add(

    "2032", "Mike Mizanin", "The Miz");

     

    multiColumnComboElement.Rows.Add(

    "4101", "Paul Levesque", "Triple H");

     

     

     


    this
    .mcboSample.AutoFilter = true;

     

     

    this.mcboSample.DisplayMember = "NickName";

     

     

     


    FilterExpression
    filter = new FilterExpression(this.mcboSample.DisplayMember, FilterExpression.BinaryOperation.AND,

     

     

    GridKnownFunction.Contains, GridFilterCellElement.ParameterName);

     

    filter.Parameters.Add(

    GridFilterCellElement.ParameterName, true);

     

     

    this.mcboSample.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filter);

    The above works fine based on NickName but I would have like have one more filter option based on RealName as well.

    Thanks

    Br,
    MKK

     

    Reply

  • Svett Svett admin's avatar

    Posted on Jan 13, 2010 (permalink)

    Hi Mukesh Kapoor,

    Thank you for contacting us. You may find more information regarding filter expressions here. You can create a second filter expression as follows:

    FilterExpression filterRealName = new FilterExpression("RealName", FilterExpression.BinaryOperation.AND, GridKnownFunction.Contains, GridFilterCellElement.ParameterName);
    filterRealName.Parameters.Add(GridFilterCellElement.ParameterName, "Your value 1");
     
    this.mcboSample.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterRealName);
     
    FilterExpression filterNickName = new FilterExpression("NickName", FilterExpression.BinaryOperation.AND, GridKnownFunction.Contains, GridFilterCellElement.ParameterName);
    filterNickName.Parameters.Add(GridFilterCellElement.ParameterName, "Your Value 2");
     
    this.mcboSample.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterNickName);       

    Please provide the reason that the type of the parameter value is Boolean when the filtered columns is a string type?

    Best wishes,
    Svett
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • dinesh kumar avatar

    Posted on Jan 25, 2010 (permalink)

    Hello,
    still am having some problem while selecting the values from the GridViewMultiComboBoxColumn.

    For Example:

    In TextChanged event while filter the values it throws an exeception "The collection already contains a FilterExpresion for the field 'RealName'.


     

    using

     

    System.Windows.Forms; 
    using Telerik.WinControls.UI;

     

     

     

    using Telerik.WinControls.Data;

     

     

     

    using System.Data;

     

     

     

    using Telerik.WinControls;

     

     

    using System.Threading;

     

     

     

     

    namespace

     

     

    MultiComboApp

     

    {

     

     

    public partial class Form3 : Form

     

     

     

     

    {

     

     

    public Form3()

     

    {

    InitializeComponent();

    }

     

     

    FilterExpression filterRealName;

     

     

     

    FilterExpression filterNickName;

     

     

     

    FilterExpression filterCode;

     

     

     

    DataTable dtData;

     

     

     

    private void LoadTable()

     

    {

    dtData =

     

    new DataTable();

     

    dtData.Columns.Add(

     

    "Code");

     

    dtData.Columns.Add(

     

    "RealName");

     

    dtData.Columns.Add(

     

    "NickName");

     

    dtData.Rows.Add(

     

    new object[] { "1011", "dinesh", "din13" });

     

    dtData.Rows.Add(

     

    new object[] { "1022", "dineshkumar", "Guru23" });

     

    dtData.Rows.Add(

     

    new object[] { "2031", "Vijay", "Vin31" });

     

    dtData.Rows.Add(

     

    new object[] { "2032", "Vignesh", "Vick32" });

     

    dtData.Rows.Add(

     

    new object[] { "4101", "Senthil", "sen01" });

     

    }

     

     

    private void FillGrid()

     

    {

     

     

     

    GridViewMultiComboBoxColumn gvmcTest = new GridViewMultiComboBoxColumn();

     

    gvmcTest.DataSource = dtData;

    gvmcTest.AutoCompleteMode =

     

    AutoCompleteMode.SuggestAppend;

     

    gvmcTest.DropDownStyle =

     

    RadDropDownStyle.DropDown;

     

    gvTest.Columns.Add(gvmcTest);

    gvTest.Columns[0].Width = 300;

    filterRealName =

     

    new FilterExpression("RealName", FilterExpression.BinaryOperation.OR,

     

     

     

    GridKnownFunction.StartsWith, GridFilterCellElement.ParameterName);

     

    filterNickName =

     

    new FilterExpression("NickName", FilterExpression.BinaryOperation.OR,

     

     

     

    GridKnownFunction.StartsWith, GridFilterCellElement.ParameterName);

     

    filterCode =

     

    new FilterExpression("Code", FilterExpression.BinaryOperation.OR,

     

     

     

    GridKnownFunction.StartsWith, GridFilterCellElement.ParameterName);

     

    }

     

     

     

    private void Form1_Load(object sender, System.EventArgs e)

     

    {

    LoadTable();

    FillGrid();

    }

     

     

     

    private void gvTest_CellEditorInitialized(object sender, GridViewCellEventArgs e)

     

    {

     

     

    RadMultiColumnComboBoxElement comboColumn = (RadMultiColumnComboBoxElement)this.gvTest.ActiveEditor;

     

    comboColumn.AutoSizeDropDownToBestFit =

     

    true;

     

    comboColumn.AutoFilter =

     

    true;

     

    comboColumn.TextChanged +=

     

    new System.EventHandler(editor_TextChanged);

     

    }

     

     

    void editor_TextChanged(object sender, System.EventArgs e)

     

    {

     

     

    RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.gvTest.ActiveEditor;

     

     

     

    string sText = editor.Text.Trim();

     

     

     

    // When the lock is obtained, add an element.

     

     

     

     

     

     

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Remove(filterRealName);

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Remove(filterNickName);

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Remove(filterCode);

    filterRealName.Parameters.Clear();

    filterNickName.Parameters.Clear();

    filterCode.Parameters.Clear();

    filterRealName.Parameters.Add(

     

    GridFilterCellElement.ParameterName, sText);

     

    filterNickName.Parameters.Add(

     

    GridFilterCellElement.ParameterName, sText);

     

    filterCode.Parameters.Add(

     

    GridFilterCellElement.ParameterName, sText);

     

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterRealName);

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterNickName);

    editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterCode);

    editor.EditorControl.GridElement.Update(

     

    GridUINotifyAction.FilteringChanged);

     

    }

     

    }

    }

     

    Attached files

    Reply

  • Julian Benkov Julian Benkov admin's avatar

    Posted on Jan 27, 2010 (permalink)

    Hello dinesh kumar,

    Thank you for contacting us. You can try to Clear the FilterExpresionCollection before adding the new filter expressions:

    void editor_TextChanged(object sender, System.EventArgs e)
    {
        RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.gvTest.ActiveEditor;
        string sText = editor.Text.Trim();
        // When the lock is obtained, add an element.
        editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Clear();
     
        filterRealName.Parameters.Clear();
        filterNickName.Parameters.Clear();
        filterCode.Parameters.Clear();
     
        filterRealName.Parameters.Add(GridFilterCellElement.ParameterName, sText);
        filterNickName.Parameters.Add(GridFilterCellElement.ParameterName, sText);
        filterCode.Parameters.Add(GridFilterCellElement.ParameterName, sText);
     
        editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterRealName);
        editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterNickName);
        editor.EditorControl.MasterGridViewTemplate.FilterExpressions.Add(filterCode);
     
        editor.EditorControl.GridElement.Update(GridUINotifyAction.FilteringChanged);
    }

    Sincerely yours,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Dzimitry Kul avatar

    Posted on Apr 21, 2010 (permalink)

    Hi there,
    I was actually using the same code snippet in the TextChanged event handler but still that does not work properly. It does filtering but when trying to select value from the filtered drop down list(in my example typing 'C' filters the list and displays 3 items in the drop down list: Cabbage, Carrot, Corn). But when I try to select any of them the first value from the DataSource(in my case it is List<string>) is picked up and displayed in the drop down automatically. Any ideas?

    Thanks,
    Dima


    Reply

  • Deyan Deyan admin's avatar

    Posted on Apr 27, 2010 (permalink)

    Hello Dzimitry,

    Although it is possible to define multiple filter expressions based on different columns in the grid view of the RadMultiColumnComboBox, this control is not particularly designed to handle this case. Each time a row is selected in the gridview the value of the current display member is considered and displayed in the text box part of the control. Currently, we do not recommend inserting multiple filter expressions in the grid view of the RadMultiColumnComboBox since undesired behavior will occur.

    I would also like to inform you that we have plans to rewrite this control and extend its functionality (also addressing the limitations of the filtering functionality), but I cannot give you an exact estimation when this will happen.

    Thanks for the understanding and do not hesitate to write back in case you have further questions.

    Kind regards,
    Deyan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

  • Levente Mihály avatar

    Posted on Jul 27, 2010 (permalink)

    The FilterExpression method seems to be obsoulted in Q2. Do you have an example code for FilterDescriptor?
    Also in the documentation the obsoluted FilterExpression method is described only.

    thanks,
    Levente

    Reply

  • Deyan Deyan admin's avatar

    Posted on Jul 30, 2010 (permalink)

    Hi Levente Mihály,

    Thanks for contacting us and for your question.

    Please take a look at the source code of the RadMultiColumnComboBox example in our Examples Application where you can find sample code demonstrating how to use the FilterDescriptor class to implement AutoFilter in the control:
    FilterDescriptor descriptor = new FilterDescriptor(this.radMultiColumnComboBox1.DisplayMember, FilterOperator.StartsWith, string.Empty);            this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(descriptor);

    I hope this helps.

    Kind regards,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Levente Mihály avatar

    Posted on Aug 2, 2010 (permalink)

    Thanks!

    Reply

  • John Seifert avatar

    Posted on Oct 1, 2010 (permalink)

    I am also trying to use multi column filtering.

    in my case the code looks like:

    public MainForm()
    {

    RadMultiColumnComboBoxElement

     

    multiColumnComboElement = cbSecurity.MultiColumnComboBoxElement;

     

    multiColumnComboElement.EditorControl.MasterGridViewTemplate.AutoGenerateColumns =

    false;

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("SecurityId"));

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("Symbol"));

     

    multiColumnComboElement.Columns.Add(

    new GridViewTextBoxColumn("SymbolDescription"));
    }

     

    protected

     

    override void OnLoad(EventArgs e)

     

    {

     

    base.OnLoad(e);

    cbSecurity.AutoFilter =

    true;

     

    cbSecurity.DataSource = securities;

    cbSecurity.DisplayMember =

    "Symbol";

     

     

    FilterDescriptor symbolDescriptor = new FilterDescriptor("Symbol", FilterOperator.StartsWith, string.Empty);

     

     

    FilterDescriptor nameDescriptor = new FilterDescriptor("SymbolDescription", FilterOperator.StartsWith, string.Empty);

     

    cbSecurity.EditorControl.FilterDescriptors.Add(symbolDescriptor);

    cbSecurity.EditorControl.FilterDescriptors.Add(nameDescriptor);

    cbSecurity.DropDownStyle =

    RadDropDownStyle.DropDown;
    }

    The problem is that the filter only seems to work on "Symbol".  I would like to have it filter based on either column.  Is this possible?

     

    Reply

  • Martin Vasilev Martin Vasilev admin's avatar

    Posted on Oct 7, 2010 (permalink)

    Hi John Seifert,

    Thank you for writing.

    RadMultiColumnComboBox does not supports auto-filtering based on more than one field. That is why adding two or more FilterDescriptors does not work as expected. We will consider including this feature in one of the next releases.

    Let me know if you have any other questions.

    Greetings,
    Martin Vasilev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Georg avatar

    Posted on Oct 4, 2011 (permalink)

    Dear Telerik-Team,

    I am using RadMultiColumnComboBox in combination with an FilterExpression. Now I want to change the the filter for the RadMultiColumnComboBox.

    multiColumnComboBox .EditorControl.MasterGridViewTemplate.FilterExpressions.Clear();
    FilterExpression myFilter = new FilterExpression("ScenarioID", FilterExpression.BinaryOperation.AND, GridKnownFunction.Contains, GridFilterCellElement.ParameterName);
    filterSupplier.Parameters.Add(GridFilterCellElement.ParameterName, "txt");
    multiColumnComboBox .EditorControl.MasterGridViewTemplate.FilterExpressions.Add(myFilter );
     
    multiColumnComboBox .EditorControl.GridElement.Update(GridUINotifyAction.FilteringChanged);

    Initially the filter is applier correctly, but when i am using the code shown, the filter is not correctly applied on the content.

    Could you please give me some hints how to fix the problem?

    Thx,
    Georg

    Reply

  • Georg avatar

    Posted on Oct 5, 2011 (permalink)

    Dear Telerik-Team,

    it seems that i had a problem with my code. It work now like a charm. But I've got an other problem. How can I programmatically select an item in the MultiColumnCombo and show the displayMember-Value correct in the MultiColumnCombo (so the value shoud be in the Text member of the Combo element).

    Thanks,
    Georg

    Reply

  • Martin Vasilev Martin Vasilev admin's avatar

    Posted on Oct 7, 2011 (permalink)

    Hello Georg,

    Thank you for writing.

    I am not sure if I understand correctly your requirement. Do you want to set the selected item? If yes, then you can use one of the RadMultiColumnComboBox's SelectedIndex, SelectedItem or SelectedValue properties.

    Let me know if you have any additional questions.

    Best wishes,
    Martin Vasilev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > MultiColumn ComboBox > MultiColumnCombo Filtering
Related resources for "MultiColumnCombo Filtering"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]