GridViewMultiComboBoxColumn dropdown closed

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

    Posted 27 Sep 2016 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
    2480 posts

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

    Posted 27 Sep 2016 in reply to Dess Link to this post

    Hello Dess 

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

    thanks You very much

     

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

    Posted 27 Sep 2016 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... 

  5. Dess
    Admin
    Dess avatar
    2480 posts

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

    Posted 04 Oct 2016 in reply to Dess Link to this post

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

    Thanks..

  7. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 03 Jan in reply to Dess Link to this post

    Hello dess... ?

    i've tried the code you wrote why it doesn't work for me ? 

    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

     

    how to call this sub ? 

     

    Thanks before

  8. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 03 Jan Link to this post

    Hai Dess 

    or how access dropdownclosed in gridviewmulticolumncombobox....

    "Me.RadGridView1.CurrentRow.Cells("CategoryID").Value = rowInfo.Cells("CategoryID").Value" i need this code run when dropdwonclosed

    Thanks

     

  9. Dess
    Admin
    Dess avatar
    2480 posts

    Posted 04 Jan Link to this post

    Hello, Hengky, 

    Thank you for writing.  

    The ValueChanged event in RadGridView is fired when you change the value in the editor. RadMultiColumnComboBoxElement automatically closed its popup when a row is selected in the inner grid. Then, the ValueChanged event will be fired and the value of the neighboring cell will be updated accordingly.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  10. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 05 Jan in reply to Dess Link to this post

    Hai Dess 

    Can i have the code for changevalue.gif ? 

    Because i have tried wrote snippet code you give to james, and it doesn't work.on me .. 

    Thanks before.

  11. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 05 Jan in reply to Hengky Link to this post

    I mean full coding not a snippet code... 

    :D

     

    Tq before dess

  12. Dess
    Admin
    Dess avatar
    2480 posts

    Posted 05 Jan Link to this post

    Hello, Hengky, 

    Thank you for writing back. 

    I have attached a sample project for your reference.

    I would kindly ask you to use our support ticketing system for any further inquiries that you have. Thus, all your threads will be handled by our support staff according to license and time of posting.

    Thank you for your understanding.

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  13. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 08 Jan in reply to Dess Link to this post

    Tq dess for writing back and for the solution 

    but i need the categoriID selected or can be change through gridmccb. not categori name.

    one more, why its very slow ? when fill data to gridmccb.

    Thanks dess

    Best Regards

    Hengky

  14. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 08 Jan in reply to Dess Link to this post

    Hai Dess thanks for writing back 

    how if i need to change the category id, not the category name.

    your example is change the categoryname, what i need is change the CategoryId on Product table

     

    thanks before 

    * i will mentioned about licensing.

  15. Dess
    Admin
    Dess avatar
    2480 posts

    Posted 08 Jan Link to this post

    Hello, Hengky, 

    Thank you for writing back. 

    It is up to you for which field you will add the GridViewMultiComboBoxColumn. It is necessary to specify the column's FieldName property (e.g. "CategoryID") and populate it with data (by the DataSource property). Then, in the RadGridView.ValueChanged event you can manipulate each cell value according to your custom requirement.  

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

     Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  16. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 08 Jan in reply to Dess Link to this post

    Hello Dess,

    thanks for the solution and now it works,

    but i have problem... like the attachment pic.

    it's error when i hit enter on column 3,4 

    column 5 is expression on column 3 and 4

     

    Thanks

  17. Dess
    Admin
    Dess avatar
    2480 posts

    Posted 09 Jan Link to this post

    Hello, Hengky, 

    Thank you for writing back. 

    I was not able to replicate the issue with my sample project. However, according to the error message, I suppose that you have only constructors with parameters in your custom object. In this case, the parameterless constructor is required by our implementation in RadGridView to create a new instance of the class and populate the data according to the data in the columns. So in order to be able to add new rows you need to add a parameterless constructor as well. 

    If it is not the case, feel free to submit a support ticket where you can provide a sample project demonstrating the undesired behavior. Thus, our support staff will gladly assist you.

    I hope this information helps. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  18. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 07 Feb in reply to Dess Link to this post

    Hai dess... sorry for late reply.... 

    how to make this happen if i use Entity Framework for fill the col ... 

                For Each s In query_detail
                    RadGridView1.Rows.Add(s.Kode, s.NamaBarang, s.Qtty, s.Harga, s.Nilai)
                Next

                Dim col As GridViewMultiComboBoxColumn = New GridViewMultiComboBoxColumn("KodeBarang")
                Dim SqlBarang = From Barang In db.MstBarangs
                                Select New With {Barang.KodeBarang, Barang.NamaBarang}

                col.DataSource = SqlBarang.ToList

                col.DisplayMember = "NamaBarang"
                col.ValueMember = "KodeBarang"
                col.MinWidth = 100
                col.FieldName = "KodeBarang"
                Me.RadGridView1.Columns.Add(col)

    the code working fine, but with one miss ... it doesn't want to show the NamaBarang for the first time

  19. Hristo
    Admin
    Hristo avatar
    1224 posts

    Posted 08 Feb Link to this post

    Hi Hengky,

    You can check the following resources discussing in details how you can bind the grid using Entity Framework:
    From your code snippet, it appears that you are doing a select which returns anonymous types. Please avoid this as the grid would not be editable. This behavior can also be observed with the standard .NET grid control. The following articles provide more information on that matter: 
    I hope this information was useful.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  20. Hengky
    Hengky avatar
    41 posts
    Member since:
    Sep 2015

    Posted 09 Feb in reply to Hristo Link to this post

    Hello Hristo, thanks for writing back... 

    i already bind the grid from EF. the blank column on the picture is MultiColumnComboBox... that fill with data to like example from Dess. ( if i use ado.net binding, its very well working) 

    How make this happen with EF.. ?

     

     

     

  21. Hristo
    Admin
    Hristo avatar
    1224 posts

    Posted 09 Feb Link to this post

    Hi Hengky,

    Binding the GridViewMultiComboBoxColumn to Entity Framework should not be much different compared to the grid. As demonstrated in the grid`s article please make sure that you load the collection in the DbContext and then access it through the Local property like this: 
    col.DataSource = dbContext.Orders.Local.ToBindingList();
     
    As I said before, please also make sure that you do not bind to a collection of anonymous types. In case you need further assistance, please open a support ticket and send us your project so that we can investigate it locally.

    Let me know if you have other questions.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top