Completed
Last Updated: 24 Aug 2012 04:41 by ADMIN
ADMIN
Stefan
Created on: 24 Aug 2012 04:41
Category: Editors
Type: Bug Report
2
FIX. RadTimePicker - exception when you try to change the AM/PM with the buttons
To reproduce:
Add a grid with a DateTime column and change its editor to GridTimePickerEditor
Run the project and on a row with no value, open the editor, press Up arrow key, change to AM and then change the hour to 12
Open the popup and click the left key to change the AM/PM

Work around:
  void radGridView1_EditorRequired(object sender, Telerik.WinControls.UI.EditorRequiredEventArgs e)
        {
            if (e.EditorType == typeof(RadDateTimeEditor))
            {
                if (radGridView1.CurrentColumn.Name == "TimeColumn")
                {
                    GridTimePickerEditor editor = new GridTimePickerEditor();
                    e.Editor = editor;
                    RadTimePickerElement element = editor.EditorElement as RadTimePickerElement;
                    element.PopupContentElement.HoursTable.TableHeader.LeftArrow.MouseDown -= new MouseEventHandler(LeftArrow_MouseDown);
                    element.PopupContentElement.HoursTable.TableHeader.LeftArrow.MouseDown += new MouseEventHandler(LeftArrow_MouseDown);
                }
            }
        }

        void LeftArrow_MouseDown(object sender, MouseEventArgs e)
        {
            RadTimePickerElement element = ((GridTimePickerEditor)this.radGridView1.ActiveEditor).EditorElement as RadTimePickerElement;
            DateTime time = (DateTime)element.Value;
            element.Value = time.AddYears(-2);
        }
0 comments