This is a migrated thread and some comments may be shown as answers.

Setting MonthView.VisibleAppointmentsPerDay via databound event breaking client side appointment clicked

1 Answer 67 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 13 Jan 2010, 11:23 PM
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

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>

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 18 Jan 2010, 09:55 AM
Hello,

Thank you for providing detailed description of the problem.

Calling GuardSchedule.Rebind() at the end of the DataBound handler should solve the problem for the moment.

We'll see if we can make this work without the Rebind call. Apologies for any inconvenience caused.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Scheduler
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
T. Tsonev
Telerik team
Share this question
or