Posted
on May 9, 2012
(permalink)
Hi,
Ok.... its getting clearer, but say I have some data like:
radCalendar.AppointmentSource = new SampleAppointmentSource();
public class SampleAppointmentSource : AppointmentSource
{
public SampleAppointmentSource()
{
}
public override void FetchData(DateTime startDate, DateTime endDate)
{
AllAppointments.Clear();
DateTime start = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
DateTime end = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 2);
IList<ViewEntry> list = DBHelper.GetReadOnlyEntrysForDate(startDate, endDate);
for (int i = 0; i < list.Count(); i++)
{
ViewEntry e = list.ElementAt(i);
AllAppointments.Add(new CalendarAppointment()
{
StartDate = e.StartDate.AddMinutes(1),
EndDate = e.StartDate.AddMinutes(1),
Subject = e.GetText();
});
}
So I am adding my own entries from the database. And these are displayed on the given days on the calendar.
Also for these appointments I want to display a little icon as well as the text.So I need my template.
In the template version supplied I don't quite see how to access the appointment information.
If I query CalendarButtonContentInfo info = item as CalendarButtonContentInfo;
The appointments in "info" are null, there are no appointments to query, kind of odd as they are displayed.
info.Appointments.Count is always 0.
Should the appointments be available in the CalendarButtonContentInfo ?? Perhaps I messed it up there?
Its like I need to display only on those days based upon my database entries, at the moment I don't see how to bind the template to the data. The only solution i have at the moment is making query in the database in the Template, but this rather silly as I have to make a ton of queries every time the template is called (31 times!).
I'm sure i messed up somewhere...
Thanks!
S.