GridViewMultiComboBoxColumn dropdown closed

6 posts, 0 answers
  1. james
    james avatar
    4 posts
    Member since:
    Sep 2016

    Posted 27 Sep Link to this post

    Dear all 

    I have a question 

    how do all this syntax in GVMCCB ? 

        Private Sub CMMBCustomer_CustomFiltering(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCustomFilteringEventArgs)

            Dim element As RadMultiColumnComboBoxElement = MCCBCustomer.MultiColumnComboBoxElement

            Dim textToSearch As String = MCCBCustomer.Text
            If AutoCompleteMode.Append = (element.AutoCompleteMode And AutoCompleteMode.Append) Then
                If element.SelectionLength > 0 AndAlso element.SelectionStart > 0 Then
                    textToSearch = MCCBCustomer.Text.Substring(0, element.SelectionStart)
                End If
            End If

            If String.IsNullOrEmpty(textToSearch) Then
                e.Visible = True

                For i As Integer = 0 To element.EditorControl.ColumnCount - 1
                    e.Row.Cells(i).Style.Reset()

                Next

                e.Row.InvalidateRow()
                Return
            End If

            e.Visible = False
            For i As Integer = 0 To element.EditorControl.ColumnCount - 1
                Dim text As String = e.Row.Cells(i).Value.ToString()
                If text.IndexOf(textToSearch, 0, StringComparison.InvariantCultureIgnoreCase) >= 0 Then
                    e.Visible = True
                    e.Row.Cells(i).Style.CustomizeFill = True
                    e.Row.Cells(i).Style.DrawFill = True
                    e.Row.Cells(i).Style.BackColor = Color.FromArgb(201, 252, 254)
                Else
                    e.Row.Cells(i).Style.Reset()

                End If
            Next
            e.Row.InvalidateRow()
        End Sub
        Private Sub CMMBCustomer_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
            With MCCBCustomer
                If e.KeyCode = System.Windows.Forms.Keys.Enter Then
                    If .ValueMember <> "" Then
                        .SelectedValue = .EditorControl.CurrentRow.Cells(.ValueMember).Value
                    Else
                        .SelectedValue = .EditorControl.CurrentRow.Cells(.DisplayMember).Value
                    End If

                    .Text = .EditorControl.CurrentRow.Cells(.DisplayMember).Value.ToString()
                    .MultiColumnComboBoxElement.ClosePopup()
                    .MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.SelectAll()
                End If
            End With
        End Sub

     

        Private Sub CMMBCustomer_DropDownClosed(ByVal sender As Object, ByVal args As Telerik.WinControls.UI.RadPopupClosedEventArgs) Handles MCCBCustomer.DropDownClosed
            If MCCBCustomer.SelectedIndex <> -1 Then
                LblNamaCustomer.Text = MCCBCustomer.EditorControl.Rows(MCCBCustomer.SelectedIndex).Cells(1).Value.ToString
            Else
                LblNamaCustomer.Text = ""
            End If
        End Sub

     

        Private Sub CMMBCustomer_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MCCBCustomer.Validated
            If MCCBCustomer.Text = "" Then
                LblNamaCustomer.Text = ""
            End If
        End Sub

     

    Thanks before... 

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 27 Sep Link to this post

    Hello James,

    Thank you for writing.  

    Note that you can handle the RadGridView.CellEditorInitialized event which is fired once the editor is initialized. This is the place where you have access to the RadMultiColumnComboBoxElement and you can subscribe to any of the desired events that you want to use:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products)
        Me.CategoriesTableAdapter.Fill(Me.NwindDataSet.Categories)
     
        Me.RadGridView1.DataSource = ProductsBindingSource
     
        Dim col As GridViewMultiComboBoxColumn = New GridViewMultiComboBoxColumn("Category")
        col.DataSource = Me.CategoriesBindingSource
        col.DisplayMember = "CategoryName"
        col.ValueMember = "CategoryID"
        col.FieldName = "CategoryID"
        Me.RadGridView1.Columns.Add(col)
     
        AddHandler Me.RadGridView1.CellEditorInitialized, AddressOf CellEditorInitialized
    End Sub
     
    Private Sub CellEditorInitialized(sender As Object, e As GridViewCellEventArgs)
        Dim mccb As RadMultiColumnComboBoxElement = TryCast(e.ActiveEditor, RadMultiColumnComboBoxElement)
        If mccb IsNot Nothing Then
            RemoveHandler  mccb.KeyDown, AddressOf mccb_KeyDown
            AddHandler mccb.KeyDown, AddressOf mccb_KeyDown
        End If
     
    End Sub
     
    Private Sub mccb_KeyDown(sender As Object, e As KeyEventArgs)
        Console.WriteLine(e.KeyData)
    End Sub

    I hope this information helps. Should you have further questions 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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. james
    james avatar
    4 posts
    Member since:
    Sep 2016

    Posted 27 Sep in reply to Dess Link to this post

    Hello Dess 

    Thanks for fast respone... i will try it first ...

    thanks You very much

     

  5. james
    james avatar
    4 posts
    Member since:
    Sep 2016

    Posted 27 Sep in reply to james Link to this post

    Hello Dess 

    i need to fill the field "NAMA" inside the gridview from mccb.dropdown how make this happen ? 

    i need to filtering too when user type in mccb gridview 

    Thanks before

     

    Note : please give me the very simple code... 

  6. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 29 Sep Link to this post

    Hello James, 

    Thank you for writing back. 

    In order to populate the RadMultiColumnComboBoxElement in the GridViewMultiComboBoxColumn with data, you can set the GridViewMultiComboBoxColumn.DataSource property to the desired collection. Additional information how to setup the columns is available here: http://docs.telerik.com/devtools/winforms/gridview/columns/column-types/gridviewmulticomboboxcolumn

    After making a selection in the editor, you can set the value for another cell on the same row. Here is a sample code snippet which result is illustrated in the attached gif file: 
    Me.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill

    Private Sub ValueChanged(sender As Object, e As EventArgs)
        Dim mccb As RadMultiColumnComboBoxElement = TryCast(Me.RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
        If mccb IsNot Nothing Then
            Dim rowInfo As GridViewDataRowInfo = TryCast(mccb.SelectedItem, GridViewDataRowInfo)
            Me.RadGridView1.CurrentRow.Cells("CategoryID").Value = rowInfo.Cells("CategoryID").Value
        End If
    End Sub

    As to the filtering functionality, you can refer to the following example. Thus, when typing in the editor, the popup grid is filtered: 
    AddHandler Me.RadGridView1.CellEditorInitialized, AddressOf CellEditorInitialized

    Private Sub CellEditorInitialized(sender As Object, e As GridViewCellEventArgs)
        Dim mccb As RadMultiColumnComboBoxElement = TryCast(e.ActiveEditor, RadMultiColumnComboBoxElement)
        If mccb IsNot Nothing Then
            mccb.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown
            mccb.AutoFilter = True
            If mccb.EditorControl.FilterDescriptors.Count = 0 Then
                Dim filter As New FilterDescriptor()
                filter.PropertyName = mccb.DisplayMember
                filter.Operator = FilterOperator.Contains
                mccb.EditorControl.MasterTemplate.FilterDescriptors.Add(filter)
            End If
        End If
    End Sub

    I hope this information helps. If you have any additional questions, please let me know.

    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.
  7. james
    james avatar
    4 posts
    Member since:
    Sep 2016

    Posted 04 Oct in reply to Dess Link to this post

    Halllo dess Many thanks to you it's work fine...

    Thanks..

Back to Top
UI for WinForms is Visual Studio 2017 Ready