Try our conversational search powered by Generative AI!

UI Hint for Date only in date time picker

Vote:
 

Hi,

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

Regards,

Vibhanshu Mirani

#150746
Jun 29, 2016 9:15
Vote:
 

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";
             
        }
    }


        [Editable(true)]
        [Display(
            Name = "Event Date",
            Description = "The Event Start Date will be shown in the Page",
            GroupName = SystemTabNames.Content,
            Order = 201)]
        [UIHint("DateOnly")]
        public virtual string EventDate { get; set; }
#150752
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.