Completed
Last Updated: 17 Mar 2015 12:59 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 06 Jan 2015 16:16
Category:
Type: Bug Report
0
FIX. RadDropDownList/CommandBarDropDownList - selection is changed when items with duplicated text exist
To reproduce: bind to a collection where the DisplayMember can be duplicated, however, the ValueMember is unique. Select the second occurrence. When you try to open the pop the next time, the first occurrence is selected.
Sub New()
    InitializeComponent()

    Dim dt As New DataTable()
    dt.Columns.Add("UniqueID", GetType(Integer))
    dt.Columns.Add("Date", GetType(DateTime))

    For index = 1 To 20
        dt.Rows.Add(index, DateTime.Today.AddDays(index Mod 4))
    Next


    Me.CommandBarDropDownList1.DisplayMember = "Date"
    Me.CommandBarDropDownList1.ValueMember = "UniqueID"
    Me.CommandBarDropDownList1.DataSource = dt

    AddHandler Me.CommandBarDropDownList1.SelectedIndexChanged, AddressOf SelectedIndexChanged
End Sub

Private Sub SelectedIndexChanged(sender As Object, e As Telerik.WinControls.UI.Data.PositionChangedEventArgs)
    RadMessageBox.Show("UniqueID: " & Me.CommandBarDropDownList1.SelectedValue)
End Sub

Workaround:

AddHandler Me.CommandBarDropDownList1.DropDownListElement.ArrowButton.MouseDown, AddressOf ArrowButton_Mouse
AddHandler Me.CommandBarDropDownList1.DropDownListElement.ArrowButton.MouseUp, AddressOf ArrowButton_Mouse
AddHandler Me.CommandBarDropDownList1.SelectedIndexChanging, AddressOf SelectedIndexChanging


Dim shouldCancel As Boolean = False
Private Sub ArrowButton_Mouse(sender As Object, e As MouseEventArgs)
    shouldCancel = Not shouldCancel
End Sub

Private Sub SelectedIndexChanging(sender As Object, e As UI.Data.PositionChangingCancelEventArgs)
    e.Cancel = shouldCancel
End Sub
0 comments