AppointmentTemplate

3 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 14 Oct 2007 Link to this post

    Hi,
    I've been trying to understand how to use this property of the scheduler. What I need to do is be able to populate the controls of the AppointmentTemplate programatically. The example provided does everything 'inline'.
    My scheduler is not directly linked to a database, but to an ArrayList of custom appointment objects (which contain a whole bunch of extra data). This extra data cannot be used as a resource of the appointment, but its required nonetheless.

    1<telerik:RadScheduler ID="RadScheduler1" runat="server" DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" Width="100%"
    2        <AppointmentTemplate> 
    3              <asp:Image ID="calIcon" runat="server" AlternateText="Icon"/> 
    4        </AppointmentTemplate> 
    5</telerik:RadScheduler> 

    Is there some sort of event/hook in which I can set the imageUrl dynamically based on certain data of an appointment? I need to have access to the 'parent appointment' to work out what to display for the image.

    Thanks
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Oct 2007 Link to this post

    Hi Fayez,

    You can use the AppointmentCreated event. For example, try the following:

    protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)  
        {  
            Image templateImage = (Image)e.Container.FindControl("calIcon");  
            templateImage.ImageUrl = e.Appointment.Subject + ".png";  
             
        } 



    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 16 Oct 2007 Link to this post

    Thanks for that, it worked like a charm!
    You guys make it look so easy ^_^;
Back to Top