In the process of updating some functionality I refactored out a user control (below).
As is, a javascript TypeError: Telerik.Web.UI.RadScheduler is undefined appears, the scheduler renders and works in every aspect except that the appointments' subjects don't appear. Removing both resource types (not just one) displays the subjects. Moving the code back to the parent page just throws slightly different javascript errors--c[0] or n is undefined; usually related to some sorting thing--but visually makes no change. It seems independent of all other properties of the radscheduler. I've looked at similar issues that suggested the web.config needed a handler, but mine's setup correctly. Another suspected the grouping, but that's not the issue here.
An appointment template ignores the data; it'll display hard-coded content. The data is accessible in the code-behind, and I've used it to manipulate the Tooltip which works fine, but the appointment subject refuses to display.
From what I've gathered, it's not connecting the scripts RadScheduler needs to run, but the fix they recommended (EnableEmbeddedScripts) didn't work for me.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TeamTodayScheduler.ascx.cs" Inherits="Private_Dashboard_TeamTodayScheduler" %>
<
telerik:RadAjaxManager
ID
=
"ramTeamToday"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"lb"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rsTeamToday"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
asp:LinkButton
ID
=
"lb"
runat
=
"server"
CssClass
=
"customRSHeader"
ForeColor
=
"#333"
Width
=
"100%"
OnClick
=
"lb_Click"
/>
<
telerik:RadScheduler
ID
=
"rsTeamToday"
runat
=
"server"
AllowDelete
=
"false"
AllowEdit
=
"false"
AllowInsert
=
"false"
ShowFooter
=
"false"
ShowHeader
=
"false"
ShowResourceHeaders
=
"false"
SelectedView
=
"TimelineView"
OverflowBehavior
=
"Expand"
Visible
=
"false"
DataSourceID
=
"ldsSchedules"
DataKeyField
=
"ScheduleID"
DataStartField
=
"ScheduleStartDate"
DataEndField
=
"ScheduleEndDate"
DataSubjectField
=
"EmployeeName"
DataRecurrenceField
=
"ScheduleRecurrenceRule"
DataRecurrenceParentKeyField
=
"ScheduleRecurrenceParentID"
OnTimeSlotCreated
=
"rsToday_TimeSlotCreated"
>
<
TimelineView
GroupBy
=
"Employee"
GroupingDirection
=
"Vertical"
ReadOnly
=
"true"
ShowInsertArea
=
"false"
StartTime
=
"08:00:00"
SlotDuration
=
"00:15:00"
NumberOfSlots
=
"36"
TimeLabelSpan
=
"4"
ColumnHeaderDateFormat
=
"h tt"
EnableExactTimeRendering
=
"true"
/>
<
ResourceTypes
>
<
telerik:ResourceType
KeyField
=
"EmployeeID"
Name
=
"Employee"
TextField
=
"EmployeeID"
ForeignKeyField
=
"ScheduleEmployeeID"
DataSourceID
=
"ldsEmployees"
/>
<
telerik:ResourceType
KeyField
=
"ScheduleActivityTypeID"
Name
=
"Activity"
TextField
=
"ScheduleActivityTypeName"
ForeignKeyField
=
"ScheduleActivityTypeID"
DataSourceID
=
"ldsActivityTypes"
/>
</
ResourceTypes
>
<
ResourceStyles
>
<
telerik:ResourceStyleMapping
Type
=
"Activity"
Text
=
"Work"
ApplyCssClass
=
"WorkSchedule"
/>
<
telerik:ResourceStyleMapping
Type
=
"Activity"
Text
=
"Class"
ApplyCssClass
=
"ClassSchedule"
/>
<
telerik:ResourceStyleMapping
Type
=
"Activity"
Text
=
"Sick"
ApplyCssClass
=
"SickSchedule"
/>
<
telerik:ResourceStyleMapping
Type
=
"Activity"
Text
=
"Vacation"
ApplyCssClass
=
"VacationSchedule"
/>
<
telerik:ResourceStyleMapping
Type
=
"Activity"
Text
=
"Extended Leave of Absence"
ApplyCssClass
=
"OffSiteSchedule"
/>
</
ResourceStyles
>
</
telerik:RadScheduler
>
<
asp:LinqDataSource
ID
=
"ldsActivityTypes"
runat
=
"server"
ContextTypeName
=
"SciNET.BusinessObjects.SciNETDataContext"
TableName
=
"ScheduleActivityTypes"
/>
<
asp:LinqDataSource
ID
=
"ldsEmployees"
runat
=
"server"
ContextTypeName
=
"SciNET.BusinessObjects.SciNETDataContext"
TableName
=
"Employees"
OnSelecting
=
"ldsEmployees_Selecting"
>
<
WhereParameters
>
<
asp:Parameter
DbType
=
"Int32"
Name
=
"TeamID"
/>
</
WhereParameters
>
</
asp:LinqDataSource
>
<
asp:LinqDataSource
ID
=
"ldsSchedules"
runat
=
"server"
ContextTypeName
=
"SciNET.BusinessObjects.SciNETDataContext"
TableName
=
"Schedules"
OrderBy
=
"ScheduleActivityTypeID Descending"
OnSelecting
=
"ldsSchedules_Selecting"
/>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
SciNET.BusinessObjects;
using
Telerik.Web.UI;
public
partial
class
Private_Dashboard_TeamTodayScheduler : System.Web.UI.UserControl
{
protected
SciNETDataContext dbContext =
new
SciNETDataContext();
public
int
TeamID
{
get
{
return
Convert.ToInt32(ldsEmployees.WhereParameters[
"TeamID"
].DefaultValue); }
set
{ ldsEmployees.WhereParameters[
"TeamID"
].DefaultValue = value.ToString(); }
}
protected
void
Page_PreRender(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
lb.Text = TeamID == 0 ?
"Full-Timers"
: (from team
in
dbContext.EmployeeTeams
where team.EmployeeTeamID == TeamID
select team).Single().EmployeeTeamName;
}
}
protected
void
lb_Click(
object
sender, EventArgs e)
{
rsTeamToday.Visible = !rsTeamToday.Visible;
}
protected
void
rsToday_TimeSlotCreated(
object
sender, TimeSlotCreatedEventArgs e)
{
if
(e.TimeSlot.Start <= DateTime.Now && e.TimeSlot.End >= DateTime.Now) e.TimeSlot.CssClass =
"Highlight"
;
}
protected
void
ldsEmployees_Selecting(
object
sender, LinqDataSourceSelectEventArgs e)
{
if
(TeamID == 0) e.Result = (from emp
in
dbContext.Employees
where !emp.EmployeeDateTerminated.HasValue
where emp.EmployeeRoles.Count(role => role.EmployeeRoleTypeID == 0) > 0
select emp).ToList();
// 0 stands for Full-timer ^^^
else
e.Result = (from emp
in
dbContext.Employees
where !emp.EmployeeDateTerminated.HasValue
where emp.EmployeeTeamID == Convert.ToInt32(e.WhereParameters[
"TeamID"
])
where emp.EmployeeRoles.Count(role => role.EmployeeRoleTypeID == 0) == 0
select emp).ToList();
if
(((List<Employee>)e.Result).Count == 0) Visible =
false
;
}
protected
void
ldsSchedules_Selecting(
object
sender, LinqDataSourceSelectEventArgs e)
{
// Note: This grabs everyone's schedules. It's easier to let the grouping filter out the ones we don't need.
e.Result = (from schedule
in
dbContext.Schedules
orderby schedule.ScheduleActivityTypeID descending
select
new
{
ScheduleID = schedule.ScheduleID,
ScheduleSubject = schedule.ScheduleSubject,
ScheduleActivityTypeID = schedule.ScheduleActivityTypeID,
ScheduleStartDate = schedule.ScheduleStartDate,
ScheduleEndDate = schedule.ScheduleEndDate,
ScheduleEmployeeID = schedule.ScheduleEmployeeID,
ScheduleRecurrenceRule = schedule.ScheduleRecurrenceRule,
ScheduleRecurrenceParentID = schedule.ScheduleRecurrenceParentID,
EmployeeName = schedule.Employee.EmployeeGivenName +
" "
+ schedule.Employee.EmployeeLastName
}).ToList();
}
}
An appointment template ignores the data; it'll display hard-coded content. The data is accessible in the code-behind, and I've used it to manipulate the Tooltip which works fine, but the appointment subject refuses to display.
From what I've gathered, it's not connecting the scripts RadScheduler needs to run, but the fix they recommended (EnableEmbeddedScripts) didn't work for me.