MultiColumnCombo Filtering

19 posts, 0 answers
  1. Mukesh Kapoor
    Mukesh Kapoor avatar
    1 posts
    Member since:
    Oct 2009

    Posted 10 Jan 2010 Link to this post

    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

     

  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 13 Jan 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. dinesh kumar
    dinesh kumar avatar
    1 posts
    Member since:
    Nov 2009

    Posted 25 Jan 2010 Link to this post

    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);

     

    }

     

    }

    }

     

  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 27 Jan 2010 Link to this post

    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.
  6. Dzimitry Kul
    Dzimitry Kul avatar
    1 posts
    Member since:
    Apr 2010

    Posted 21 Apr 2010 Link to this post

    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


  7. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 27 Apr 2010 Link to this post

    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.
  8. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 27 Jul 2010 Link to this post

    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
  9. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 30 Jul 2010 Link to this post

    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
  10. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 02 Aug 2010 Link to this post

    Thanks!
  11. John Seifert
    John Seifert avatar
    6 posts
    Member since:
    Jul 2012

    Posted 01 Oct 2010 Link to this post

    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?

     

  12. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 07 Oct 2010 Link to this post

    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
  13. Georg
    Georg avatar
    4 posts
    Member since:
    Jul 2011

    Posted 04 Oct 2011 Link to this post

    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
  14. Georg
    Georg avatar
    4 posts
    Member since:
    Jul 2011

    Posted 05 Oct 2011 Link to this post

    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
  15. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 07 Oct 2011 Link to this post

    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 >>

  16. agung
    agung avatar
    2 posts
    Member since:
    May 2014

    Posted 13 Jun 2015 Link to this post

    Hello...

    Please help me. Can't filter by Kode. but filter by nama is work. 

    For reference, here is my example again which is now working correctly

    Imports Telerik.WinControls.UI
    Imports Telerik.WinControls.Data
    Imports Telerik.WinControls
     
    Public Class RadForm2
    #Region "WindowsGenerateForm"
        Inherits Telerik.WinControls.UI.RadForm
     
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
     
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
     
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer. 
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.RadGridView1 = New Telerik.WinControls.UI.RadGridView()
            Me.RadLabel1 = New Telerik.WinControls.UI.RadLabel()
            CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.RadGridView1.MasterTemplate, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'RadGridView1
            '
            Me.RadGridView1.BackColor = System.Drawing.Color.FromArgb(CType(CType(191, Byte), Integer), CType(CType(219, Byte), Integer), CType(CType(255, Byte), Integer))
            Me.RadGridView1.Cursor = System.Windows.Forms.Cursors.Default
            Me.RadGridView1.EnableHotTracking = False
            Me.RadGridView1.Font = New System.Drawing.Font("Segoe UI", 8.25!)
            Me.RadGridView1.ForeColor = System.Drawing.Color.Black
            Me.RadGridView1.ImeMode = System.Windows.Forms.ImeMode.NoControl
            Me.RadGridView1.Location = New System.Drawing.Point(17, 32)
            '
            'RadGridView1
            '
            Me.RadGridView1.MasterTemplate.AllowAddNewRow = False
            Me.RadGridView1.MasterTemplate.EnableGrouping = False
            Me.RadGridView1.MasterTemplate.EnableSorting = False
            Me.RadGridView1.Name = "RadGridView1"
            Me.RadGridView1.RightToLeft = System.Windows.Forms.RightToLeft.No
            Me.RadGridView1.ShowGroupPanel = False
            Me.RadGridView1.Size = New System.Drawing.Size(629, 236)
            Me.RadGridView1.TabIndex = 0
            Me.RadGridView1.Text = "RadGridView1"
            '
            'RadLabel1
            '
            Me.RadLabel1.Location = New System.Drawing.Point(110, 8)
            Me.RadLabel1.Name = "RadLabel1"
            Me.RadLabel1.Size = New System.Drawing.Size(58, 18)
            Me.RadLabel1.TabIndex = 1
            Me.RadLabel1.Text = "RadLabel1"
            '
            'RadForm2
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(669, 292)
            Me.Controls.Add(Me.RadLabel1)
            Me.Controls.Add(Me.RadGridView1)
            Me.Name = "RadForm2"
            '
            '
            '
            Me.RootElement.ApplyShapeToControl = True
            Me.Text = "RadForm2"
            CType(Me.RadGridView1.MasterTemplate, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
            Me.PerformLayout()
     
        End Sub
        Friend WithEvents RadGridView1 As Telerik.WinControls.UI.RadGridView
        Friend WithEvents RadLabel1 As Telerik.WinControls.UI.RadLabel
    #End Region
     
        Sub New()
            InitializeComponent()
        End Sub
     
        Private KontakList As List(Of clsModel)
        Private tbSubscribed As Boolean = False
        Private Sub RadForm2_Load1(sender As Object, e As EventArgs) Handles Me.Load
     
            KontakList = GetAllKontak()
            With RadGridView1
                .Columns.Add("Nama")
                .Columns.Add("Alamat")
                .MultiSelect = True
                .AllowRowResize = False
                .AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
            End With
     
            Dim Kode As New GridViewMultiComboBoxColumn()
            With Kode
                .Name = "Kode"
                .HeaderText = "Kode"
                .DisplayMember = "kode"
                .ValueMember = "kode"
                '.DataSource = KontakList
            End With
     
            RadGridView1.Columns.Insert(0, Kode)
     
            RadGridView1.Rows.AddNew()
        End Sub
     
        Private Sub RadGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized
     
     
            Dim multiComboElement As RadMultiColumnComboBoxElement = TryCast(RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
     
            If multiComboElement IsNot Nothing Then
                With multiComboElement
                    .DataSource = KontakList
                    .DropDownStyle = RadDropDownStyle.DropDown
                    .EditorControl.MasterTemplate.BestFitColumns()
                    .AutoSizeDropDownToBestFit = True
                    .DisplayMember = "kode"
                    .ValueMember = "kode"
                    .Text = ""
     
                    Dim fkode As FilterDescriptor = New FilterDescriptor("Kode", FilterOperator.StartsWith, String.Empty) ' FilterOperator.Contains, "")
                    fkode.IsFilterEditor = False
                    .EditorControl.FilterDescriptors.Add(fkode)
     
                    Dim fnama As FilterDescriptor = New FilterDescriptor("Nama", FilterOperator.StartsWith, String.Empty) ' FilterOperator.Contains, "")
                    fnama.IsFilterEditor = False
                    .EditorControl.FilterDescriptors.Add(fnama)
     
     
                    .EditorControl.FilterDescriptors.LogicalOperator = FilterLogicalOperator.[Or]
                    .AutoCompleteMode = AutoCompleteMode.SuggestAppend
                    .AutoFilter = True
     
                    '.EditorControl.GridBehavior = New MyMultiColumnComboGridBehavior()
     
     
                    If .EditorControl.FilterDescriptors.Count = 0 Then
                        .EditorControl.FilterDescriptors.Add(.DisplayMember, FilterOperator.StartsWith, [String].Empty)
                    End If
     
                    AddHandler .TextBoxElement.TextBoxItem.HostedControl.KeyDown, AddressOf TextBox_KeyDown
     
                    'AddHandler .EditorControl.SelectionChanged, AddressOf cKontak_SelectedIndexChanged
     
                End With
            End If
     
            Dim tbEditor As RadTextBoxEditor = TryCast(RadGridView1.ActiveEditor, RadTextBoxEditor)
            If Not tbEditor Is Nothing Then
                If (Not tbSubscribed) Then
                    tbSubscribed = True
                    Dim tbElement As RadTextBoxEditorElement = CType(tbEditor.EditorElement, RadTextBoxEditorElement)
                    AddHandler tbElement.KeyDown, AddressOf CellEditor_KeyDown
                End If
            End If
        End Sub
     
        Private Sub TextBox_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
     
            Select Case RadGridView1.Columns(RadGridView1.CurrentColumn.Index).Name
                Case "Kode"
                    If e.KeyCode = Keys.Enter Then
     
                        Dim element As RadMultiColumnComboBoxElement = TryCast(RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
                        If element.EditorControl.CurrentRow IsNot Nothing AndAlso element.EditorControl.CurrentRow.DataBoundItem IsNot Nothing Then
                            Dim kontak As clsModel = TryCast(element.EditorControl.CurrentRow.DataBoundItem, clsModel)
     
                            If kontak Is Nothing Then
                                Return
                            End If
     
                            Dim index As Integer = Me.KontakList.IndexOf(kontak)
                            element.SelectedIndex = index
     
                            RadGridView1.CurrentRow.Cells("Kode").Value = kontak.Kode
                            RadGridView1.CurrentRow.Cells("Nama").Value = kontak.Nama
                            RadGridView1.CurrentRow.Cells("Alamat").Value = kontak.Alamat
     
                            element.Invalidate(True)
                        End If
     
                        Dim currentCell = RadGridView1.Rows(RadGridView1.Rows.Count - 1).Cells(2)
                        currentCell.IsSelected = True
                        currentCell.BeginEdit()
     
                    End If
                    If e.KeyCode = Keys.Down Then
                        Dim element As RadMultiColumnComboBoxElement = TryCast(RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
                        element.ShowPopup()
                    End If
            End Select
        End Sub
        Private Sub CellEditor_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
            If e.KeyCode = Keys.Enter Then
                Select Case RadGridView1.Columns(RadGridView1.CurrentColumn.Index).Name
                    Case "Alamat"
                        Dim rowInfo As New GridViewDataRowInfo(RadGridView1.MasterView)
                        Dim editor As RadTextBoxEditorElement = TryCast(sender, RadTextBoxEditorElement)
     
                        rowInfo.Cells("Kode").Value = ""
                        rowInfo.Cells("Nama").Value = ""
                        rowInfo.Cells("Alamat").Value = ""
                        RadGridView1.Rows.Add(rowInfo)
     
                        Dim currentCell = RadGridView1.Rows(RadGridView1.Rows.Count - 1).Cells(0)
                        currentCell.IsSelected = True
                        currentCell.BeginEdit()
                End Select
            End If
        End Sub
     
        'Private Sub cKontak_SelectedIndexChanged(sender As Object, e As EventArgs)
        '    Dim multiComboElement As RadMultiColumnComboBoxElement = TryCast(RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
        '    Dim text As String
        '    text = multiComboElement.EditorControl.Rows(multiComboElement.SelectedIndex).Cells("Nama").Value
        '    RadLabel1.Text = text
        'End Sub
     
        Public Shared Function GetAllKontak() As IList(Of clsModel)
            Dim daftarKontak = New List(Of clsModel)()
     
            daftarKontak.Add(New clsModel() With {.Kode = "110001", .Nama = "AGUNG", .Alamat = "Jl. Bandung"})
            daftarKontak.Add(New clsModel() With {.Kode = "110002", .Nama = "BUDI", .Alamat = "Jl. Jakarta"})
            daftarKontak.Add(New clsModel() With {.Kode = "110003", .Nama = "ADI AGUNG", .Alamat = "Jl. Bumi Mondoroko"})
            daftarKontak.Add(New clsModel() With {.Kode = "110004", .Nama = "AHMAD BAJURI", .Alamat = "Jl. Gajayana"})
            daftarKontak.Add(New clsModel() With {.Kode = "110005", .Nama = "SAHARA IRA", .Alamat = "Jl. Sumbersari"})
            daftarKontak.Add(New clsModel() With {.Kode = "110006", .Nama = "JULIUS", .Alamat = "Jl. Puncak Joyo"})
            daftarKontak.Add(New clsModel() With {.Kode = "110007", .Nama = "IKAWATI", .Alamat = "Jl. Pahlawan"})
            daftarKontak.Add(New clsModel() With {.Kode = "110008", .Nama = "RONI STIAWAN", .Alamat = "Jl. Selorejo"})
            daftarKontak.Add(New clsModel() With {.Kode = "110009", .Nama = "JAKA SEMBUNG", .Alamat = "Jl. Sarangan"})
            daftarKontak.Add(New clsModel() With {.Kode = "110010", .Nama = "BRAHMA KUMBARA", .Alamat = "Jl. Bendungan Sutami"})
            daftarKontak.Add(New clsModel() With {.Kode = "110011", .Nama = "JAKA SENA", .Alamat = "Jl. Veteran"})
            daftarKontak.Add(New clsModel() With {.Kode = "110012", .Nama = "PRAMA ANGGANA", .Alamat = "Jl. Surabaya"})
            daftarKontak.Add(New clsModel() With {.Kode = "110013", .Nama = "WIRO SABLENG", .Alamat = "Jl. Kayu Tangan"})
     
            Return daftarKontak
     
        End Function
     
     
    End Class
     
    Imports System.ComponentModel
     
    Public Class clsModel
        Private _kode As String
        Private _nama As String
        Private _alamat As String
         
        Public Event PropertyChanged As PropertyChangedEventHandler
     
       
        Public Property Kode() As String
            Get
                Return Me._kode
            End Get
            Set(value As String)
                If Me._kode <> value Then
                    Me._kode = value
                    OnPropertyChanged("Kode")
                End If
            End Set
        End Property
        Public Property Nama() As String
            Get
                Return Me._nama
            End Get
            Set(value As String)
                If Me._nama <> value Then
                    Me._nama = value
                    OnPropertyChanged("Nama")
                End If
            End Set
        End Property
     
        Public Property Alamat() As String
            Get
                Return Me._alamat
            End Get
            Set(value As String)
                If Me._alamat <> value Then
                    Me._alamat = value
                    OnPropertyChanged("Alamat")
                End If
            End Set
        End Property
     
        Protected Overridable Sub OnPropertyChanged(propertyName As String)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
        End Sub
     
    End Class

  17. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 15 Jun 2015 Link to this post

    Hello Agung,

    Thank you for writing.

    I managed to use all of your code and build an example project. On my side the data is filtered correctly either by "Kode" or by "Nama".  In your last message you also mention that your example is now working correctly, this is what I also observed on my end.

    Just in case I am sending you a sample project as well as a gif file showing the result on my side.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  18. agung
    agung avatar
    2 posts
    Member since:
    May 2014

    Posted 01 Jul 2015 in reply to Hristo Merdjanov Link to this post

    Yeah right, fix problem when I do update telerik in 2015 version. Code can't work in 2014 version.

    Thx Hristo Merdjanov

  19. Veton
    Veton avatar
    1 posts
    Member since:
    Jul 2016

    Posted 30 Jul in reply to Hristo Merdjanov Link to this post

    Hello Project downalod 
  20. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 01 Aug Link to this post

    Hello Veton,

    Thank you for writing. 

    Do you have any question related to this forum thread? I would be glad to help. 

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready