Repro steps:
System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.WinControls.UI.RadDateTimePickerCalendar.popupControl_Closing(Object sender, RadPopupClosingEventArgs args)Expected behavior:
- The dropdown closes after moving to another cell.
- No exception occurs.
Hi Martin,
The provided steps are greatly appreciated. By following them I was able to reproduce this exception and I can confirm that this is unexpected and the drop-down part should be closed when moving to another cell. The exception itself comes from the fact that the RadDateTimePicker element is no longer visible when another cell is in edit mode.
What I can suggest as a workaround is to create a custom InputBehavior and override the HandleTabKey() method. In the method, you could get the current VirtualGridDateTimeEditor from the ActiveEditor property of the RadVirtualGrid. Then you can manually close the Popup part.
public class CustomVirtualGridInputBehavior : VirtualGridInputBehavior
{
public CustomVirtualGridInputBehavior(RadVirtualGridElement gridElement) : base(gridElement)
{
}
protected override bool HandleTabKey(KeyEventArgs keys)
{
var editor = this.GridElement.ActiveEditor;
if(editor != null)
{
var dateTimeEditor = editor as VirtualGridDateTimeEditor;
if (dateTimeEditor != null)
{
var editorElement = dateTimeEditor.EditorElement as RadDateTimeEditorElement;
(editorElement.CurrentBehavior as RadDateTimePickerCalendar).PopupControl.ClosePopup(new PopupCloseInfo(RadPopupCloseReason.ParentClosed, ""));
}
}
return base.HandleTabKey(keys);
}
}
this.radVirtualGrid1.VirtualGridElement.InputBehavior = new CustomVirtualGridInputBehavior(this.radVirtualGrid1.VirtualGridElement);
Your Telerik Points are updated for your time reporting this exception.
Regards,
Dinko | Tech Support Engineer
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/.