This is a migrated thread and some comments may be shown as answers.
DateTimePicker: Make available just a few days
1 Answer 7 Views
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
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.
Asked by
Marc
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or