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

[Solved] Additional Information

3 Answers 245 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
.NET Coder
Top achievements
Rank 1
.NET Coder asked on 25 Sep 2007, 06:16 PM
I have three fields in my table that I would like to display on any of the views.  Is there a way to have more than just the subject field display in the viewing area?

3 Answers, 1 is accepted

Sort by
0
.NET Coder
Top achievements
Rank 1
answered on 26 Sep 2007, 06:26 PM
I am looking to have the calendar display additional fields from the database.  This will give the user more information about the scheduled subject.  It looks like an earlier posting attempts to answer this question, but I need a little more information on how to implement this. I created a SqlDataSource to retrieve this additional information as read-only and have the four fields bound to the scheduler.  How can I get Subject2 and Subject3 to display along side Subject1?
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
0
.NET Coder
Top achievements
Rank 1
answered on 27 Sep 2007, 03:21 PM

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>

0
Dimitar Milushev
Telerik team
answered on 28 Sep 2007, 12:14 PM
Hi,

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,

Dimitar Milushev
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
.NET Coder
Top achievements
Rank 1
Answers by
.NET Coder
Top achievements
Rank 1
Dimitar Milushev
Telerik team
Share this question
or