3 Answers, 1 is accepted
Database Fields
ID,
DateStart,
DateEnd,
Subject 1
Subject 2 - to display on the day, week, and monthly views
Subject 3 - to display on the day, week, and monthly views
This is my attempt to make it work.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="EndDate" DataKeyField="ScheduleID"
DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
DataSourceID="SqlDataSource1" DataStartField="StartDate" DataSubjectField="Subject"
DayEndTime="18:00:00" DayStartTime="08:00:00" HoursPanelTimeFormat="h:mm tt"
SelectedDate="2007-09-20" TimeZoneOffset="00:00:00" WorkDayEndTime="17:00:00"
WorkDayStartTime="08:00:00" ReadOnly="True" SelectedView="WeekView" OverflowBehavior="Expand">
<AppointmentTemplate>
<%# Eval("Subject2") %>
<%# Eval("Subject3") %>
</AppointmentTemplate>
</telerik:RadScheduler>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SchedulerConnectionString %>"
SelectCommand="SELECT dbo.Schedule.ScheduleID, dbo.Schedule.DeviceID, dbo.Schedule.Subject2, dbo.Schedule.Subject3, dbo.Schedule.StartDate, dbo.Schedule.EndDate, dbo.Schedule.RecurrenceRule, dbo.Schedule.RecurrenceParentID, dbo.Device.DeviceID AS Expr1, dbo.Device.Subject, dbo.Device.Branch FROM dbo.Device RIGHT OUTER JOIN dbo.Schedule ON dbo.Device.DeviceID = dbo.Schedule.DeviceID">
</asp:SqlDataSource>
You are on the right track - you need to use templates to show additional info for an appointment. Any appointment data besides the standard Subject, Start, End etc. is called an 'Attribute'. For the Scheduler to retrieve and recognize this additional data you need to set the CustomAttributeNames property. For example:
CustomAttributeNames="Subject2,Subject3"
Then in the template you can retrieve the attribute values from the Attributes collection of the appointment:
<%# Eval("Attributes['Subject2']") %>
<%# Eval("Attributes['Subject3']") %>
Note that you also need to Eval the default Subject property if you want it to be rendered in your template. In the end, your code should look similar to this:
| <telerik:RadScheduler ID="RadScheduler2" runat="server" DataEndField="EndDate" DataKeyField="ScheduleID" |
| CustomAttributeNames="Subject2,Subject3" DataRecurrenceField="RecurrenceRule" |
| DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SqlDataSource1" |
| DataStartField="StartDate" DataSubjectField="Subject" DayEndTime="18:00:00" DayStartTime="08:00:00" |
| HoursPanelTimeFormat="h:mm tt" SelectedDate="2007-09-20" TimeZoneOffset="00:00:00" |
| WorkDayEndTime="17:00:00" WorkDayStartTime="08:00:00" ReadOnly="True" SelectedView="WeekView" |
| OverflowBehavior="Expand"> |
| <AppointmentTemplate> |
| <%# Eval("Subject") %> |
| <%# Eval("Attributes['Subject2']") %> |
| <%# Eval("Attributes['Subject3']") %> |
| </AppointmentTemplate> |
| </telerik:RadScheduler> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SchedulerConnectionString %>" |
| SelectCommand="SELECT dbo.Schedule.ScheduleID, dbo.Schedule.DeviceID, dbo.Schedule.Subject2, dbo.Schedule.Subject3, dbo.Schedule.StartDate, dbo.Schedule.EndDate, dbo.Schedule.RecurrenceRule, dbo.Schedule.RecurrenceParentID, dbo.Device.DeviceID AS Expr1, dbo.Device.Subject, dbo.Device.Branch FROM dbo.Device RIGHT OUTER JOIN dbo.Schedule ON dbo.Device.DeviceID = dbo.Schedule.DeviceID"> |
| </asp:SqlDataSource> |
All the best,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center