Declined
Last Updated: 24 Nov 2018 23:13 by KKL
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 25 Sep 2018 07:14
Category:
Type: Bug Report
1
FIX. RadListView - ActiveEditor shouldn't be null in the ItemValueChanging
To reproduce: run the attached sample project. Select an item and press F2, select a new item from the drop-down. You will encounter an error because the ActiveEditor is now null in the ItemValueChanging event.

Workaround: in the EditorInitialized event you can subscribe to the RadDropDownListElement.SelectedIndexChanging event:

private void radListView1_EditorInitialized(object sender, ListViewItemEditorInitializedEventArgs e)
{
    ListViewDropDownListEditor editor = e.Editor as ListViewDropDownListEditor;
    if (editor==null)
    {
        return;
    }
    RadDropDownListElement dropdown = (RadDropDownListElement)editor.EditorElement;
    dropdown.SelectedIndexChanging-=dropdown_SelectedIndexChanging;
    dropdown.SelectedIndexChanging+=dropdown_SelectedIndexChanging;
}


Attached Files:
3 comments
KKL
Posted on: 24 Nov 2018 23:13
Additionally, what is the point of being able to set e.Cancel if the new value can't be compared to the old value? 
KKL
Posted on: 03 Oct 2018 10:50
Previously, it was easy to subscribe to the ItemValueChanging event, examine the DropDownListElement and Cancel based on the result. Is there no easy way to do this any more, apart from the workaround that Dess has supplied? 
ADMIN
Ivan Petrov
Posted on: 03 Oct 2018 10:22
The idea behind this event is to be fired before the value of a ListViewDataItem is changed. Changes to an item occur after an editor for a particular property is closed or when the value is set through code. At this point, there is no editor active in the list view since the value of the editor is already validated and submitted as the new value to be set to the property, therefore, the ActiveEditor property is null. This wasn't the case before R3 2018 which was a wrong behaviour.