This is a migrated thread and some comments may be shown as answers.

DateTimePicker: Make available just a few days

1 Answer 65 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Veteran
Marc asked on 02 Oct 2018, 06:14 AM

Hey,

I want to make available just the 1st and the 15th of a month.

How can I get this?

 

Regards

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 02 Oct 2018, 10:40 AM
Hi Marc,

You can use the ElementRender event to disable the dates. Here is an example:
public RadForm1()
{
    InitializeComponent();
    radDateTimePicker1.DateTimePickerElement.Calendar.ElementRender += Calendar_ElementRender;
}
 
private void Calendar_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
{
    if (e.Day.Date.Day != 1 && e.Day.Date.Day != 15)
    {
        e.Element.Enabled = false;
    }
    else
    {
        e.Element.Enabled = true;
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Marc
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Share this question
or