Not showing changed Subject in TimeLineView

2 posts, 0 answers
  1. Kushil
    Kushil avatar
    6 posts
    Member since:
    Mar 2011

    Posted 23 Jun 2011 Link to this post

    I am using radScheduler in a typical web form page with server side binding to a generic list. I use timeline view only.
    In client side's "OnClientAppointmentResizeEnd" javascript event I need to change the subject of the appointment to the new duration. It will help the user to clearly see the change she did.
    I am using the following code.
    function OnClientAppointmentResizeEnd(sender, args) {
        var start = args.get_appointment().get_start();
        var end = args.get_targetSlot().get_endTime();
        var appDuration = Math.ceil((end.getTime() - start.getTime()) / (60000)); // show in minutes                       
        appointment.set_subject(appDuration);
        //alert(appDuration);
    }
    The above works well with web service binding and the user can see the subject of the appoinment changes to the new duration as she resizes the appointment. But this does not work (appointment subject change is not visible) with server side binding.
    Any ideas apart from using AppointmentUpdate server side event?
    Thanks and regards
    Kushil
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Jun 2011 Link to this post

    Hi Kushil,

    After OnClientAppointmentResizeEnd, a postback occurs to update the appointment, so you cannot use the client API in this case. If you handle OnClientAppointmentClick, there is no postback in this case so you could do the following:

    Copy Code
    function OnClientAppointmentClick(sender, args) {
    var appointment = args.get_appointment();
    appointment.set_subject("test");
    sender.updateAppointment(appointment, false);
    }

    Note that you need to use the updateAppointment() method to permanently persist the changes.

    I am not sure why you don't want to hadle the server-side AppointmentUpdate, but you can still consider it:
    Copy Code
    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
    {
    if (e.Appointment.End != e.ModifiedAppointment.End)
    {
    e.ModifiedAppointment.Subject = e.ModifiedAppointment.Duration.TotalMinutes.ToString();
    }
    }

    Please, explain if there are any reasons why you cannot use this approach.




    Kind regards,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top