Completed
Last Updated: 01 Oct 2014 12:15 by Jason
ADMIN
Dimitar
Created on: 13 Aug 2014 13:35
Category: DataEntry and DataLayout
Type: Bug Report
0
FIX. RadDataEntry - when RadDateTimePicker with FreeFormDateTime mask type is used the value is not updated.
To reproduce:
- Bind RadDataEntry to an object that has DateTime property.
- Change the value using the FreeFormDateTime mask type (enter 101010).
- The value is not changed.

Workaround:

RadDateTimePicker editor;

void radDataEntry1_EditorInitializing(object sender, EditorInitializingEventArgs e)
{
    if (e.Property.Name == "obj")
    {
        editor = new RadDateTimePicker();
        editor.Format = DateTimePickerFormat.Short;
        editor.DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;
        RadMaskedEditBoxElement element = editor.DateTimePickerElement.TextBoxElement.TextBoxItem.Parent as RadMaskedEditBoxElement;
        FreeFormDateTimeProvider provider = element.Provider as FreeFormDateTimeProvider;

        provider.ParsedDateTime += provider_ParsedDateTime;

        e.Editor = editor;
        
    }
}

void provider_ParsedDateTime(object sender, EventArgs e)
{
    editor.Value = (DateTime)(sender as FreeFormDateTimeProvider).Value;
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
Jason
Posted on: 27 Aug 2014 07:04
This also seems to affect the RadDateTimePicker when it is on an ordinary form, and the GridDateTimeCellElement.  Is there a work-around for those?  Will they be fixed also?

I tried subscribing to the ParsedDateTime event, but it never seems to get called.
	public class CustomRadDateTimePicker : RadDateTimePicker
	{
		protected override void OnCreateControl()
		{
			base.OnCreateControl();

			DateTimePickerElement.Calendar.ShowFooter = true;
			DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;

			RadMaskedEditBoxElement element = DateTimePickerElement.TextBoxElement.TextBoxItem.Parent as RadMaskedEditBoxElement;
			FreeFormDateTimeProvider provider = element.Provider as FreeFormDateTimeProvider;

			provider.ParsedDateTime += ProviderOnParsedDateTime;
		}
		private void ProviderOnParsedDateTime(object sender, EventArgs eventArgs)
		{
			Value = (DateTime)(sender as FreeFormDateTimeProvider).Value;
		}
	}