This is what I have:
class AppointmentInfo
{
private readonly string _id;
private string _subject;
private DateTime _start;
private DateTime _end;
private string _unit;
private string _clr;
private string _img;
public string ID
{
get { return _id; }
}
public string Subject
{
get { return _subject; }
set { _subject = value; }
}
public DateTime Start
{
get { return _start; }
set { _start = value; }
}
public DateTime End
{
get { return _end; }
set { _end = value; }
}
public string Unit
{
get { return _unit; }
set { _unit = value; }
}
public string Clr
{
get { return _clr; }
set { _clr = value; }
}
public string Img
{
get { return _img; }
set { _img = value; }
}
private AppointmentInfo()
{
_id =
Guid.NewGuid().ToString();
}
public AppointmentInfo(string unitid, DateTime start, DateTime end, string unit, string clr, string img)
:
this()
{
_subject = unitid;
_start = start;
_end = end;
_unit = unit;
_clr = clr;
_img = img;
}
public AppointmentInfo(Appointment source)
:
this()
{
CopyInfo(source);
}
public void CopyInfo(Appointment source)
{
Subject = source.Subject;
Start = source.Start;
End = source.End;
//Resource unit = source.Resources.GetResourceByType("unit");
//if (user != null)
//{
// UnitID = (int?)unit.Key;
//}
//else
//{
// UnitID = null;
//}
}
}
public
partial class Calendar : Common.PortalPage
{
private const string AppointmentsKey = "Telerik.Web.Examples.Scheduler.BindToList.CS.Apts";
private List<AppointmentInfo> UnitList
{
get
{
List<AppointmentInfo > sessApts = Session[AppointmentsKey] as List<AppointmentInfo>;
if (sessApts == null)
{
sessApts =
new List<AppointmentInfo>();
Session[AppointmentsKey] = sessApts;
}
return sessApts;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session.Remove(AppointmentsKey);
ResourceType resType = new ResourceType("unit");
resType.ForeignKeyField =
"UnitID";
RadScheduler1.ResourceTypes.Add(resType);
RadScheduler1.Resources.Add(
new Resource("unit", 1, "unit1"));
RadScheduler1.Resources.Add(
new Resource("unit", 2, "unit2"));
RadScheduler1.Resources.Add(
new Resource("unit", 3, "unit3"));
LoadData();
}
RadScheduler1.DataSource = UnitList;
}
private void LoadData()
{
...get data from sql db
units = SIMS.BL.Presentation.Contracts.
Extensions.GetPortalCalendarUnits(this.UserCredential, request);
UnitList.Clear();
foreach (InspectionUnit Unit in units)
{
UnitList.Add (
new AppointmentInfo(Convert.ToString(Unit.UnitID), (DateTime)(Unit.InsTimeBlockStart),
(
DateTime)(Unit.InsTimeBlockEnd), Unit.Unit, Unit.Clr, Unit.Img));
}
}ASPX code:
<
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadScheduler1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<td valign="top" >
<telerik:RadScheduler ID="RadScheduler1" runat="server" SelectedView="WeekView"
Width ="884px" Skin="Web20"
DayStartTime="07:00:00" DayEndTime="20:00:00"
DataKeyField="ID" DataStartField="Start" DataEndField="End" DataSubjectField="Subject"
OnAppointmentCreated="RadScheduler1_AppointmentCreated"
onappointmentclick="RadScheduler1_AppointmentClick"
OnNavigationComplete="RadScheduler1_NavigationComplete"
onappointmentinsert="RadScheduler1_AppointmentInsert"
>
<AdvancedForm Modal = "false" />
<TimelineView UserSelectable="false" />
<TimeSlotContextMenuSettings EnableDefault ="true" />
<AppointmentContextMenuSettings EnableDefault ="true" />
<Reminders Enabled="false" />
</telerik:RadScheduler>
There are at least three records from the database, I can't figure why the scheduler is not displaying the data?
Thanks in advance for your help
Dan Pocica