Custom attributes for appointment

2 posts, 0 answers
  1. Majid
    Majid avatar
    7 posts
    Member since:
    Feb 2014

    Posted 21 Apr 2014 Link to this post


    We are testing the radScheduler for ASP.NET AJAX, we need to drag a branch name and ID from the tree view and create a visit schedule for that branch. On the nodeDropping event  we are creating a new appointment, can we add a new attribute to the appointment from the client side other than set_start, set_end and set_subject, like below we need to add "SiteId" as an attribute to the appointment.

                        var newAppointment = new Telerik.Web.UI.SchedulerAppointment();
                        newAppointment.get_attributes().setAttribute("SiteId", siteId);

    And in the server-side on post back, we will get all the appointments and update the database accordingly.

       foreach (Appointment a in RadScheduler1.Appointments)
                string strSiteID;
                string strSubjectSiteId = a.Subject;
                DateTime startDate = a.Start;           
               string siteID = a.Attributes["SiteId"];         

    There is no error thrown we set the attribute at the client side, but in server side we are getting null and this attribute count is set to 0.
    We have added the CustomAttributeNames="SiteId" into the markup.

    Can you please guide us how we can add a custom attribute to the a Telerik.Web.UI.SchedulerAppointment.

    Thank you



  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2062 posts

    Posted 24 Apr 2014 Link to this post

    Hello  Majid,

    Thank you for contacting Telerik Support.

    I would like to clarify that when RadScheduler is populated using server-side binding only the appointment required fields could be set from the client-side: start time, end time and subject. Any additional fields such as description and custom attributes could be set from the client-side only with web service binding.

    A valid workaround in this case would be to use hidden fields on the page for description and your custom attributes and store those values in them. Since the hidden fields have runat="server" set they are available on the server so you can read the appointment description and custom attribute values and assign to the appointment object on the server in AppointmentInsert event handler. This event is fired once a new appointment is about to be added to the RadScheduler control. In other words it will be fired just after calling the RadScheduler client-side object method insertAppointment and pass the appointment object.

    Please find attached a sample project that implements very similar scenario.

    Boyan Dimitrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top