Found Bug on RadDropDownList

8 posts, 0 answers
  1. Leandro
    Leandro avatar
    50 posts
    Member since:
    Jul 2015

    Posted 11 Jun 2019 Link to this post

    I'm currently using version 2018.1.116.40, don't know if this issue was resolved on recent version.

    - Add raddropdownList to form(I'm currently adding directly to a user control, inside radpageview, and then to the form) and set it to dropdownlist style

    - Set it DisplayMember and ValueMember

    - Set a datasource where at least 2 items have the same description.

    - Subscribe to SelectedIndexChanged or changing or valueChanged, and on this event show any form with ShowDialog or Focus() on other control.

    - Run Project

    - Select the second repeated item, wait for dialog or Focus, then check selected item on dropdown, it will always be the first repeated item, if repeat other description like

    'TEST1', 'TEST1', 'TEST1', 

    'TEST2','TEST2', 'TEST2'

    the selected item will be the first 'TEST1' or the first 'TEST2', and it goes on

     

  2. Nadya
    Admin
    Nadya avatar
    484 posts

    Posted 12 Jun 2019 Link to this post

    Hello Leandro,

    I was able to replicate the issue with the specified version 2018.1.116.40. However, it was fixed in the next release version 2018.1.220. In the latest versions I am not able to observe it.

    Could you please get the latest version 2019.2.508 and see how it works on your end?

    I am looking forward to your reply.

    Regards,
    Nadya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. bla
    bla avatar
    25 posts
    Member since:
    Aug 2020

    Posted 07 Oct 2020 Link to this post

    Hi guys, I still found a bug on the RadDropDownList in v2019.1.219.40!

    Actually I don't even see what Leandro's problem was, but here is my error:

    1. I cannot set any ValueMember or DisplayMember (and so on). As you see in the screenshot, right after setting the values with my code, the value is set to an empty string. As there is no error message or exception, the control must actively ignore or reset my input. That cannot be wanted.

    2. Surprisingly the value of items in the list is used correctly. I get the "value" filed of the selected object, althoug I never told the control about it. If the control is so "smart" to use a "value" called field automatically, OK. But when I name my display member "display" there is no effect again. One behaviour must be a mistake / extremely weird and unexplainable to the programmer.

    So how can I chose a DisplayMember or why is it so broken? The whole documentation doesn't mention anything about this property's behaviour again...

    This is the definition of the data source delivering finction: Function getUmgebungsbedingungen() As List(Of DisplayItem). The Members are Strings in the DisplayItem class. Of course, I have testet, that they are all filled with correct data at that time.

    Thank you in advance!

  4. bla
    bla avatar
    25 posts
    Member since:
    Aug 2020

    Posted 07 Oct 2020 in reply to bla Link to this post

    I made another test setting the Member before the data source, but confuses me even more.

    1. It is being set now whyever.

    2. When I set a ValueMember, also the DisplayMember is being set, which can never help I believe. The only reason to set the DisplayMember is to have it DIFFERENT to the Value.

    3. Setting a data source deletes all Member entries again. 

  5. bla
    bla avatar
    25 posts
    Member since:
    Aug 2020

    Posted 07 Oct 2020 Link to this post

    And as I am already at the right spot, I have another question ;):

    How can it happen, that my SelectedIndexChanged event handler is called by the right event, but then the SelectedValue is Nothing??? It happened, when I set the dataSource. Usually it works, so I receive the first element there, but sometimes it does not. Logically this case is impossible.

  6. Nadya
    Admin
    Nadya avatar
    484 posts

    Posted 09 Oct 2020 Link to this post

    Hello,

    Following the provided information so far it seems that you use the 2019.1.219 Telerik version and you have RadDropDownList inbound mode

    Data binding is a mechanism for the automatic population of the RadDropDownList with items, based on the provided data structure. Three properties control the data-binding:

    • DataSource - specifies the data structure to be bound.
    • DisplayMember - specifies the particular field in the data source which will be used from the items in RadDropDownList for their Text.
    • ValueMember - specifies the particular field in the data source which will be stored in the items Value property.

    More information about data binding in RadDropDownList is available here: https://docs.telerik.com/devtools/winforms/controls/dropdown-listcontrol-and-checkeddropdownlist/dropdownlist/populating-with-data/data-binding 

    According to the attached picture, it is strange that the DisplayMember property points to an empty string although it is set to some value. I created a sample project in order to test it with the specified 2019.1.219 version. However, the data-binding mechanism works fine on my end:

    I attached my project to this thread for your reference. Could you please refer to it and let me know how it differs from yours? 

    According to your last post, it seems that you are trying to get the SelectedValue from the drop-down list. Have in mind that the SelectedValue will store the respective field's value that is specified as ValueMember. If the ValueMember was not specified at the time of setting the DataSource, you won't get the expected SelectedValue

    More information about the selection is available here: https://docs.telerik.com/devtools/winforms/controls/dropdown-listcontrol-and-checkeddropdownlist/dropdownlist/features/selection#selection-events 

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

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

  7. bla
    bla avatar
    25 posts
    Member since:
    Aug 2020

    Posted 15 Oct 2020 in reply to Nadya Link to this post

     

    Hello,

     

    the only difference I see so far is that CustomersTableAdapter, which I have no idea of. I just used the DataSource Property with  a List (Of DisplayItems). They are defined like this:
    Public Class DisplayItem
            Public Text As String
            Public SCEProperty As String
            Public WorkbenchProperty As String
            Public Value As String

            Public Sub New(aValue As String, aText As String, aSCEProperty As String, aWorkbenchProperty As String)
                Value = aValue
                Text = aText
                SCEProperty = aSCEProperty
                WorkbenchProperty = aWorkbenchProperty
            End Sub
        End Class

     

    Text does still not work at all and value works, although there is also no ValueMember set. Both stay unexplainable to me.

  8. Nadya
    Admin
    Nadya avatar
    484 posts

    Posted 19 Oct 2020 Link to this post

    Hello,

    According to the provided information, it seems that you have a list of custom objects (DisplayItems) to which you bind the RadDropDownList control. I suppose that you use the provided DisplayItem class to populate the list. Using it I was able to observe the described behavior. It seems that the properties in the DisplayItem class are not correctly created and this is causing the problem that you have. I modified it a little in order to get it to work, you can see now that there are references to the constructor. 

    Please refer to the following thread for more information: https://stackoverflow.com/questions/31521452/creating-a-class-and-custom-objectsor-types-to-use-when-instantiating 

    Below is the code snippet for binding RadDropDownList to the list of DisplayItem objects:

    Public Class RadForm1
        Sub New()
            InitializeComponent()
        End Sub
    
        Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim list As New List(Of DisplayItem)()
            list.Add(New DisplayItem("Item1", "Text1", "aSCEProperty1", "aWorkbenchProperty1"))
            list.Add(New DisplayItem("Item2", "Text2", "aSCEProperty2", "aWorkbenchProperty2"))
            list.Add(New DisplayItem("Item3", "Text3", "aSCEProperty3", "aWorkbenchProperty3"))
    
            RadDropDownList1.DataSource = List
            Me.RadDropDownList1.DisplayMember = "Text"
            Me.RadDropDownList1.ValueMember = "Value"
    
        End Sub
    End Class
    
    Public Class DisplayItem
        Public Property Text As String
        Public Property SCEProperty As String
        Public WorkbenchProperty As String
        Public Property Value As String
    
        Public Sub New(aValue As String, aText As String, aSCEProperty As String, aWorkbenchProperty As String)
            Value = aValue
            Me.Text = aText
            Me.SCEProperty = aSCEProperty
            Me.WorkbenchProperty = aWorkbenchProperty
        End Sub
    End Class
    
    

    I hope this information helps. Let me know if I can assist you further.

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

Back to Top