Hi,
I'm trying to update the RadSchedule.MonthView.VisibleAppointmentsPerDay property in the ScheduleDataBound event. When I do this, the schedule displays the appointments correctly, however none of the client side appointment clicked events work. If i set the property at design time, the appointment click events work.
Below is the settings for the scheduler
I'm trying to update the RadSchedule.MonthView.VisibleAppointmentsPerDay property in the ScheduleDataBound event. When I do this, the schedule displays the appointments correctly, however none of the client side appointment clicked events work. If i set the property at design time, the appointment click events work.
Below is the settings for the scheduler
protected void Page_Load(object sender, EventArgs e) |
{ |
GuardSchedule.DataKeyField = "ID"; |
GuardSchedule.DataSubjectField = "Subject"; |
GuardSchedule.DataStartField = "StartDateTime"; |
GuardSchedule.DataEndField = "EndDateTime"; |
GuardSchedule.SelectedView = SchedulerViewType.MonthView; |
GuardSchedule.ShowViewTabs = false; |
GuardSchedule.OverflowBehavior = OverflowBehavior.Expand; |
GuardSchedule.ShowNavigationPane = false; |
GuardSchedule.AllowDelete = false; |
GuardSchedule.AllowEdit = false; |
GuardSchedule.AllowInsert = false; |
GuardSchedule.OnClientAppointmentClick = "AppointmentClicked"; GuardSchedule.DataBound += new EventHandler(GuardSchedule_DataBound); |
} void GuardSchedule_DataBound(object sender, EventArgs e) { DateTime viewStartDateTime = GuardSchedule.VisibleRangeStart; DateTime viewEndDateTime = GuardSchedule.VisibleRangeEnd; _appMax = 2; int numApps = 0; DateTime startTime = viewStartDateTime; DateTime endTime = viewStartDateTime.AddDays(1); while (startTime <= viewEndDateTime) { numApps = GuardSchedule.Appointments.GetAppointmentsInRange(startTime, endTime).Count; if (numApps > _appMax) _appMax = numApps; startTime = startTime.AddDays(1); endTime = endTime.AddDays(1); } GuardSchedule.MonthView.VisibleAppointmentsPerDay = _appMax; } |
<scipt> |
function AppointmentClicked(sender, eventArgs) { |
var apt = eventArgs.get_appointment(); |
var aptID = apt.get_id(); |
//Do stuff with the id |
} |
</script> <telerik:RadScheduler ID="GuardSchedule" runat="server" SelectedView="MonthView" ShowViewTabs="false"> </telerik:RadScheduler> |