We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Disabling certain dates in MonthCalendarAdv

Hello, Is there any property in MonthCalendarAdv or DateTimePickerAdv that I can use to disable a set of dates? The user should not be able to click on these dates when making selection. Thanks, John

3 Replies

AD Administrator Syncfusion Team April 18, 2005 07:41 PM UTC

Hi John, While there isn''t a property to disable dates, MonthCalendarAdv offers an event, DateCellQueryInfo, that allows you to customize individual cells in the calendar. For example, the following code snippet demonstrates disabling all days before DateTime.Today in the imbedded MonthCalendarAdv of a DateTimePicker: private void dateTimePickerAdv1_Calendar_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e) { if ((DateTime)(e.DateValue) < DateTime.Today) { e.Style.Font.Strikeout = true; e.Style.TextColor = Color.Gray; e.Style.Enabled = false; } } Hope this helps. Regards, Gregory Austin Syncfusion Inc.


JO John April 18, 2005 08:44 PM UTC

Greg, Thanks for the prompt reply. The dates are disabled, but if user clicks on any disabled date, then the calendar automatically treats as if the click is performed for the currently selected date. The date in the DatePickerAdv is refreshed to the currently selected date, so no change there, but the MonthCalendarAdv popup disappear. Is this an expected behavior? Thanks again, John


AD Administrator Syncfusion Team April 19, 2005 03:38 PM UTC

Hi John, Yes, that is the expected behavior of the PopupControlContainer. However, if you want to change that functionality you could use the CustomPopupWindow property to create your own popup with custom behavior. Regards, Gregory Austin Syncfusion Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon