AI OnAI Off
Hi!
It won't be enough to just make it editable because you will also have to handle the default backend implementation of the Modified property. Even if you make it editable and change the value manually, Episerver will step in and check if the "Update modified date" is checked. If true, it will set the Modified property to DateTime.Now and overwrite the value set in the UI.
However, this code will make the property editable and you can dig around and see if you can do some workaround to the default backend stuff. :)
[EditorDescriptorRegistration(TargetType = typeof (DateTime?), EditorDescriptorBehavior = EditorDescriptorBehavior.OverrideDefault)] public class CustomDateTimeEditorDescriptor : EPiServer.Shell.ObjectEditing.EditorDescriptors.DateTimeEditorDescriptor { public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes) { base.ModifyMetadata(metadata, attributes); if (metadata.PropertyName.Equals("ichangetrackable_changed")) { metadata.ShowForEdit = true; metadata.ShowForDisplay = true; metadata.IsReadOnly = false; } } }
Hi,
am trying to make the property Modified editable in Editmode.
Is there a custom written EPiServer Dojo that makes that property read only.
Can i override that?
Are there any other options on the metadata object that i can change?
I have tried like this.
[EditorDescriptorRegistration(TargetType = typeof(DateTime?))] attributes)
public class MakeModifiedEditableEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable
{
base.ModifyMetadata(metadata, attributes);
if (metadata.PropertyName.Equals("ichangetrackable_changed"))
{
metadata.ShowForEdit = true;
metadata.ShowForDisplay = true;
metadata.ClientEditingClass = "epi/shell/widget/DateTimeSelectorDropDown";
}
}
}