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

AppointmentTemplate

2 Answers 173 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 15 Oct 2007, 01:01 AM
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.

<telerik:RadScheduler ID="RadScheduler1" runat="server" DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" Width="100%"
        <AppointmentTemplate> 
              <asp:Image ID="calIcon" runat="server" AlternateText="Icon"/> 
        </AppointmentTemplate> 
</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 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Oct 2007, 02:43 PM
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
0
EmpowerIT
Top achievements
Rank 2
answered on 17 Oct 2007, 01:29 AM
Thanks for that, it worked like a charm!
You guys make it look so easy ^_^;
Tags
Scheduler
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Peter
Telerik team
EmpowerIT
Top achievements
Rank 2
Share this question
or