This is a migrated thread and some comments may be shown as answers.

MultiColumnComboBox selected value not working in the case of USERCONTROLER

1 Answer 62 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Jihad
Top achievements
Rank 1
Jihad asked on 29 Sep 2020, 02:20 PM

Hello , 

I need to change the selected value in my parent form but the component is in the user controller .

So when I set the value to the multicombobox does not work knowing that the text and selected index take the value well .

 

                    Dim page As New RadPageViewPage()
                    Dim panel As New MyPanel()
                    strip= TryCast(RadPage1.ViewElement, RadPageViewStripElement)
                    page.Text = "page" & (strip.Items.Count + 1)
                   
                    Dim Liste1 As List(Of object) 
                    panel.RadMultiColCmbo1.DisplayMember = "Name"
                    panel.RadMultiColCmbo1.ValueMember = "PK"
                    panel.RadMultiColCmbo1.DataSource = Liste1

                    dim object 1 = myobject 

                   panel.RadMultiColCmbo1.Selectedvalue =myobject.PK 

 

Please help! 

Thank you 

                    
                 

       

1 Answer, 1 is accepted

Sort by
0
Nadya
Telerik team
answered on 02 Oct 2020, 01:14 PM

Hello, Jihad,

If I understand you correctly, you have RadMultiColumnComboBox control which you use within a UserControl and you want to set the SelectedValue property to some value in the parent form.

I created a sample project where I created a user control with RadMultiColumnComboBox in order to test this and it seems to work correctly on my end. When I set the SelectedValue property in the main form the value is shown correctly in the multicolumn combo box.

Public Class UserControl1
    Public Sub New()
        InitializeComponent()
        Dim people As List(Of Person) = New List(Of Person)()

        For i As Integer = 0 To 50 - 1
            people.Add(New Person() With {
                .Id = i,
                .Name = "Name " & i
            })
        Next

        Me.RadMultiColumnComboBox1.DataSource = people
        Me.RadMultiColumnComboBox1.ValueMember = "Id"
        Me.RadMultiColumnComboBox1.DisplayMember = "Name"
    End Sub

    Public ReadOnly Property RadMultiColumnComboBox As RadMultiColumnComboBox
        Get
            Return Me.RadMultiColumnComboBox1
        End Get
    End Property
End Class

Public Class Person
    Public Property Id As Integer
    Public Property Name As String
End Class

' Main Form
Public Class RadForm1
    Public Sub New()
        InitializeComponent()
        Dim control As UserControl1 = New UserControl1()
        Me.Controls.Add(control)
        control.RadMultiColumnComboBox.SelectedValue = 2
    End Sub
 End Class

I attached my test project for your reference. Could you please refer to it and let me know how it differs from your set up?

I am looking forward to your reply.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
MultiColumn ComboBox
Asked by
Jihad
Top achievements
Rank 1
Answers by
Nadya
Telerik team
Share this question
or