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

Is there and event for month change on Schedule Control?

I am trying to capture when a user changes the month on the caption panel on the schedule control. Is there an event that captures that? I have been unable to find anything. Any help would be appreciated.

thanks,
peter



9 Replies

RC Rajadurai C Syncfusion Team January 19, 2009 01:52 PM UTC

Hi Peter,

Thanks for your interest in Syncfusion products.

Apologies for the delay.

You can track the change in text in caption panel by handling the following event.

this.scheduleControl1.HeaderLabel.TextChanged += new EventHandler(HeaderLabel_TextChanged);

void HeaderLabel_TextChanged(object sender, EventArgs e)
{
//code
}



Regards,
Rajadurai



PT Peter Titus January 19, 2009 02:48 PM UTC

That worked to handle the text change. Now I am trying to pull the current date on the control. I am using ScheduleControl1.Calendar.DateValue, but that doesn't seem to be consistant with what the text is showing. Is there a better date to use? Or do I need to parse the header text? What happens now is that the text doesn't change on the first click on the left arrow, but the dateValue does. So if you click twice, the dateValue goes back two months but the text only goes back one. Any help is appreciated. Or if you want me to move this over to Direct-Trac, let me know. It seems like it might be getting bigger than a quick forum question.



PT Peter Titus January 20, 2009 05:51 PM UTC

I figured out how to manually do this via the following code. Let me know if you had something better, but this seems to work.

Dim StartDate As New Date(Me.ScheduleControl1.Calendar.DateValue.Year, Me.ScheduleControl1.Calendar.DateValue.Month, 1)
Dim EndDate As Date = StartDate.AddMonths(1)

While StartDate < EndDate
arr.Add(StartDate)
StartDate = StartDate.AddDays(1)
End While
Me.ScheduleControl1.Calendar.SelectedDates.AddRange(arr)
Me.ScheduleControl1.Refresh()





JJ Jisha Joy Syncfusion Team January 23, 2009 06:33 AM UTC

Hi Perter,

Thank you for your update. Thanks for sharing information with us.

Regards,
Jisha



BR Brainative December 23, 2018 06:53 PM UTC

can you show me in VB.Net?


AA Arulraj A Syncfusion Team December 24, 2018 06:29 AM UTC

Hi Brainative, 

Thanks for using Syncfusion product. 

To get the event when navigating to next month, you could use the Calendar.DateValueChanged event. Please refer the following code example and the sample. 

VB 
AddHandler Me.scheduleControl1.Calendar.DateValueChanged, AddressOf Calendar_DateValueChanged 
Private Sub Calendar_DateValueChanged(ByVal sender As Object, ByVal e As EventArgs) 
    'To get the top left date in month calendar. 
    Dim startTime As DateTime = Me.scheduleControl1.Calendar.TopLeftDate 
    'To get all the dates of current selected month date. 
    Dim selectedDates = Me.scheduleControl1.Calendar.SelectedDates 
    'To get the schedule view 
    Dim type As ScheduleViewType = Me.scheduleControl1.ScheduleType 
End Sub 
 

Please let us know if you have any concerns. 

Arulraj A 



CL Chris L July 18, 2020 11:59 AM UTC

I'm afraid that your sample code does not always work because the scheduleControl1.Calendar.DateValueChanged event does NOT fire in ALL circumstances.
Yes, it will fire if the arrow buttons are clicked to change a whole month, BUT it does not fire when the DateTimePicker is used to select a date that is AFTER the BottomRightDate and that date is therefore in a different month.
Also, why is the value of BottomRightDate ALWAYS the last day of next month, but the DateTimePicker shows days after it up to the following Sunday AND I have even seen it show dates as far as the following 2 Sundays.
How can I use the schedule control to know when to get a new set of appointments from the appointments database or to update the appointments that are being placed out of the display on the screen?
ALSO, why does the DateTimePicker start on a Sunday but the displayed dates in the Grid part of the control always starts on a Monday?  Surely that in itself is an unnecessary complication and I can't find any way to synchronise them both so that they both always start on a Monday or they both start on a Sunday (or any other day for that matter).


BT Balamurugan Thirumalaikumar Syncfusion Team July 20, 2020 04:30 PM UTC

Hi Chris,

Thank you for the update.

We could understand the scenario. We have forwarded the query to our development team for further validation and we will update you with proper details on 22nd July 2020. Until then,we appreciate your patience.

Regards,
Balamurugan.Thirumalaikumar
  
  



BT Balamurugan Thirumalaikumar Syncfusion Team July 21, 2020 04:00 PM UTC

Hi Chris, 
 
Thank you for your patience. 
 
 
scheduleControl1.Calendar.DateValueChanged event does NOT fire in ALL circumstances. 
The DateValue for the CalendarGrid will be set internally when the month is changed using the navigation button or ContextMenuItems click is occurred. In order to notify the application when the ScheduleViewType is changed by clicking on the calendar, we suggest you to use the SelectionsChanged event of SelectedDates collection. 
 
Example code  
//Event subscription 
this.scheduleControl1.Calendar.SelectedDates.SelectionsChanged += Calendar_SelectionsChanged; 
  
//Event suscription 
//For DateTimePicker 
private void Calendar_SelectionsChanged(object sender, EventArgs e) 
 { 
   this.scheduleControl1.Calendar.DateValue = this.scheduleControl1.Calendar.DateValue.AddYears(1); 
} 
why does the DateTimePicker start on a Sunday but the displayed dates in the Grid part of the control always starts on a Monday? 
In order to set the Sunday as starting day of the week, the MonthCalendarStartDayOfWeek property can be used. 
 
Example code 
//Property For Modify DayOfWeek 
scheduleControl1.Appearance.MonthCalendarStartDayOfWeek = DayOfWeek.Sunday; 
 
  
 
Thanks & Regards, 
Balamurugan Thirumalaikumar  


Loader.
Live Chat Icon For mobile
Up arrow icon