Disable some dates
I need to disable some dates into DateTimePickerAdv, is it possible?
For example, I have a dates range: { 20/12/2014, 21/12/2014, 22/12/2014 }
I need to disable the midle one or in others situations the last one, can anybody help me?
Thank you.
Hi Mateus,
Thank you for using Syncfusion products,
The reported requirement of disabling the dates in
DateTimePickerAdv can be achieved by handling the DateCellQueryInfo event of
calendar as shown in the below code snippet.
Code snippet[C#]:
|
void Calendar_DateCellQueryInfo(object
sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs
e) {
// This event enables user to customize
MonthCalenderAdv DateCells
if (e.RowIndex == 3 && e.ColIndex
> 6)
{
e.Style.BackColor = Color.Snow;
e.Style.Enabled = false;
}
else
{
// To set selectable Date cells BackColor
e.Style.BackColor = Color.FromArgb(13,
134, 64);
} } |
We have also prepared a sample and it can be downloaded from
the following link:
Sample link: http://www.syncfusion.com/downloads/support/directtrac/131842/datetimepicker695623093.zip
Please let us know if you need further assistance,
Regards,
Ashwini
Thank you for the response, I have tried in the DateCellQueryInfo event but is not possible invalidate the click in a invalid date and the calendar popup is closed, there is a solution for it?
Tank you so much!
Mateus
I've found the solution
Code snippt[c#]
private void PopupWindow_BeforeCloseUp(object sender, CancelEventArgs e)
{
if(somecondition)
e.Cancel = true;
}
Thank you!
Hi Mateus,
Thank you for the update,
Please let us know if you need further assistance.
Regards,
Ashwini
- 4 Replies
- 2 Participants
-
MC Mateus Caires da Silva
- Dec 5, 2014 01:43 PM UTC
- Dec 9, 2014 11:54 AM UTC