Select month only using DateTimePicker

Is there any way to use the DateTimePickerAdv to select only year and month and hide the selection of date from the user?

1 Reply

LS Lingaraj S Syncfusion Team August 11, 2010 11:05 AM UTC

Hi Jonas,

Thank you for your interest in Syncfusion products.

Please try using DateCellQueryInfo event with DataTimePickerAdv to avoid the Date selection as shown below.

private void dateTimePickerAdv1_Calendar_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e)
{
if (((DateTime)e.DateValue).Day != dateTimePickerAdv1.Value.Day)
{
e.Style.Enabled = false;
e.Style.Font.Strikeout = true;
e.Style.TextColor = Color.Gray;
}
}


Also refer the Knowledgebase article from following link
http://www.syncfusion.com/support/kb/1327/Where-should-we-do-the-validation-when-a-user-selects-a-date-from-the-DateTimePickerAdv-controlAlso-the-date-selected-or-entered-cannot-be-prior-than-today

Please let me know if you have any queries.

Regards,
Lingaraj S.

Loader.
Up arrow icon