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

Disable OnAppointmentClick event by appointment

3 Answers 149 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Annelle
Top achievements
Rank 1
Annelle asked on 07 Nov 2012, 04:35 PM
I'm working on a project that requires a user to click on an appointment to trigger an event. I'm using the OnAppointmentClick to accomplish this, but I need to disable the click event for certain appointments displayed.

I'd prefer the event not even fire for those appointments, but can't find any way to accomplish this on a appointment by appointment level.

Thanks for any help and suggestions you may have.
Chris

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 08 Nov 2012, 10:23 AM
Hi Chris,

 
You can set AllowEdit="false" in the AppointmentDataBound event to the appropriate appointments.

Hope this will be helpful.

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Annelle
Top achievements
Rank 1
answered on 08 Nov 2012, 01:10 PM
Good Morning Plamen,
I tried setting the Allowedit to false previously but the onclick event still fires. Here is what my settings look like:

Even with the allowedit to false the OnAppointmentClick event still fires. While I can use the actual edit event to turn appointments on and off when clicked, it brings up the edit appointment functions which I do not want to do. I'm trying to show all existing appointments on a calendar, and only make a small portion of them clickable(to trigger some code in the OnAppointmentClick event that will book the appointment for the logged in user). As it exists below all events are clickable. While I can filter the OnAppointmentClick to only process on appointments of type 'Advising', I'd rather no events are raised when other appointment types are clicked on.

Thanks
Chris

<telerik:RadScheduler ID="RadSchedulerAppt" runat="server" DataKeyField="id" DataSubjectField="subject" DataStartField="start" DataEndField="end" CustomAttributeNames="type,isrecurring" SelectedView="WeekView" OverflowBehavior="Expand" ShowFooter="false" ShowAllDayRow="false" AppointmentStyleMode="Default" ReadOnly="true" WeekView-DayStartTime="07:00:00" WeekView-DayEndTime="18:00:00" FirstDayOfWeek="Monday" LastDayOfWeek="Friday" OnAppointmentDataBound="RadSchedulerAppt_AppointmentDataBound" OnAppointmentClick="RadSchedulerAppt_AppointmentClick" OnNavigationComplete="RadSchedulerAppt_NavigationComplete">
        <TimelineView UserSelectable="false" />
        <MonthView UserSelectable="false" />
        <WeekView UserSelectable="false" HeaderDateFormat="MMMM d,yyyy" ColumnHeaderDateFormat="dddd" />
        <DayView UserSelectable="false" />
    </telerik:RadScheduler>



protected void RadSchedulerAppt_AppointmentDataBound(object sender, SchedulerEventArgs e)
    {
        switch (e.Appointment.Attributes["type"].ToString())
        {
            case "Advising":
                e.Appointment.CssClass = "rsCategoryBlue";
                break;
            case "FYI":
                e.Appointment.CssClass = "rsCategoryGreen";
                e.Appointment.AllowEdit = false;
                break;
            case "Scheduled Appointment":
                e.Appointment.CssClass = "rsCategoryDarkGreen";
                e.Appointment.AllowEdit = false;
                break;
            default:
                e.Appointment.AllowEdit = false;
                break;
        }
    }

protected void RadSchedulerAppt_AppointmentClick(object sender, SchedulerEventArgs e)
    {
        if (e.Appointment.Attributes["type"] == "Advising")
        {
            // Code to update appointments with a type of Advising only.
        }
    }


0
Plamen
Telerik team
answered on 13 Nov 2012, 08:14 AM
Hello Chris,

I have tried the scenario once again and it worked properly at my side. I am attaching my sample test project and here you can see a video of my test. Please review them and let me know if I am missing something.
 
Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Annelle
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Annelle
Top achievements
Rank 1
Share this question
or