Hide button of DateTimePicker

The DateTimePicker offers several properties to customize the control. Setting "ReadOnly" to true turns the control into something like a TextBox that can display a DateTime object. Since the user cannot edit the DateTime object in this case, it does not make sense that the button for opening the calendar popup is shown.

I'm looking for a way to hide this button since in my case, I only need to display a DateTime object. Either, will you hide the calendar popup button in ReadOnly mode (since it does not make sense!) or is there any other way how I can hide this button on the control. A global CSS tweak will no help, since I have other DateTimePicker controls on my page that are supposed to be editable.

Thanks!

One more thing about the DatePicker component: In the calendar popup the selected date is highlighted, but is there any way to also highlight the current date (e.g. in a less stressed way like a gray circle around the day number? Most calendar controls offer a way to highlight the current day, like e.g. Outlook)....

1 Like

You can target using CSS any specify DatePicker by id:



You can also use DateRender event to style desired date:

    void DateRenderNoWeekends(DateRenderEventArgs args)
    {
        if (args.Date.Date == DateTime.Today)
        { 
            args.Attributes.Add("style", "background-color: red;");
        }
    }
1 Like