Try our conversational search powered by Generative AI!

UI Hint for Date only in date time picker



Can anyone please give me an example of how can i use UI Hint for only Date selection (no time) using DateTime property.


Vibhanshu Mirani

Jun 29, 2016 9:15

I used an old solution for this once. Haven't tried it in newer version though: 

[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "DateOnly")]

    public class DateEditorDescriptor : EditorDescriptor
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DateEditorDescriptor()
            //The default editing class that will be used in forms editing mode.
            ClientEditingClass = "dijit.form.DateTextBox";

        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
            base.ModifyMetadata(metadata, attributes);
            //Define what kind of editor we want to have, in this case we want to create an inline editor. This is used
            //when the user is in "on page editing" mode.
            metadata.CustomEditorSettings["uiWrapperType"] = "inline";
            //Specify the class for a custom editor responsible for the actual editing.
            //If not defined the default (forms) editor will be used.
            metadata.CustomEditorSettings["uiType"] = "dijit.form.DateTextBox";

            Name = "Event Date",
            Description = "The Event Start Date will be shown in the Page",
            GroupName = SystemTabNames.Content,
            Order = 201)]
        public virtual string EventDate { get; set; }
Jun 29, 2016 9:52
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.