I have an object type called a CalendarEvent (it's a Linq2SQL object) that I'm trying to use to populate a Telerik Schedule control (2010.2.292.35). But in spite of everything appearing to work in the code, the schedule control still renders as not having any events at all.
My scenario involves the the events being matches between two sports teams. The user enters an abbreviation(s) for their team in a text box (comma delimited) and I display the games matching the team(s) entered. At the moment I only have two records in the database with the same team code, in this case SW600. So I'm just searching for all events that match that team. My Linq2SQL DAL returns two results as expected and all the values are populated correctly as well. I am using the Linq method ToList() to return the collection as a list since every example I can find for the schedule control using generics uses a List.
Here's the pertinent code as far as I can tell.
The aspx code for the control is as follows
Is there something that I'm missing that would explain why this doesn't work for me?
My scenario involves the the events being matches between two sports teams. The user enters an abbreviation(s) for their team in a text box (comma delimited) and I display the games matching the team(s) entered. At the moment I only have two records in the database with the same team code, in this case SW600. So I'm just searching for all events that match that team. My Linq2SQL DAL returns two results as expected and all the values are populated correctly as well. I am using the Linq method ToList() to return the collection as a list since every example I can find for the schedule control using generics uses a List.
Here's the pertinent code as far as I can tell.
Public
ReadOnly
Property
TeamsCodes
As
String
()
Get
Return
txtTeams.Text.Trim().Replace(
" "
,
""
).Split(
","
)
End
Get
End
Property
Public
ReadOnly
Property
CalendarEvents()
As
IList(Of CalendarEvent)
Get
If
_calendarEvents
Is
Nothing
Then
_calendarEvents = _dataContext.CalendarEvents.Where(
Function
(g) g.StartDate.Month = DateTime.Now.Month
And
TeamsCodes.Contains(g.TeamCode)).ToList()
End
If
Return
_calendarEvents
End
Get
End
Property
Protected
Sub
btnBuildCalendar_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
btnBuildCalendar.Click
If
(
Not
String
.IsNullOrEmpty(txtTeams.Text))
Then
rsCalendarEvents.DataSource = CalendarEvents
End
If
End
Sub
The aspx code for the control is as follows
<
telerik:RadScheduler
ID
=
"rsCalendarEvents"
runat
=
"server"
readonly
=
"true"
DataKeyField
=
"CalendarEventId"
DataSubjectField
=
"EventName"
DataDescriptionField
=
"EventDescription"
DataStartField
=
"StartDate"
DataEndField
=
"EndDate"
Height
=
"600px"
>
</
telerik:RadScheduler
>
Is there something that I'm missing that would explain why this doesn't work for me?