Disable OnAppointmentClick event by appointment

4 posts, 0 answers
  1. Annelle
    Annelle avatar
    2 posts
    Member since:
    Dec 2011

    Posted 07 Nov 2012 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 08 Nov 2012 Link to this post

    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.
  3. Annelle
    Annelle avatar
    2 posts
    Member since:
    Dec 2011

    Posted 08 Nov 2012 Link to this post

    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.
            }
        }


  4. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 13 Nov 2012 Link to this post

    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.
Back to Top