Hi all:
I have a custom control inside Sitefinity that implements the RadScheduler. When the page loads, it shows correctly, but when I try to change the selected date, I get this error:
Server Error in '/SiteFinity' Application. DataKeyField, DataSubjectField, DataStartField and DataEndField are required for databinding
This properties are setted in the code behind. This is the code I used:
And the code behind is
What's wrong?
I have a custom control inside Sitefinity that implements the RadScheduler. When the page loads, it shows correctly, but when I try to change the selected date, I get this error:
Server Error in '/SiteFinity' Application. DataKeyField, DataSubjectField, DataStartField and DataEndField are required for databinding
This properties are setted in the code behind. This is the code I used:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Calendar.ascx.cs" Inherits="SitefinityWebApp.Controls.Calendar" %><telerik:RadScheduler ID="rsCalendar" runat="server" Skin="Office2007" ReadOnly="True" SelectedView="MonthView" MonthView-VisibleAppointmentsPerDay="15" OverflowBehavior="Expand" CustomAttributeNames="Link" RowHeight="35px"> <TimelineView UserSelectable="false" /> <WeekView UserSelectable="false" /> <DayView UserSelectable="false" /> <AdvancedForm DateFormat="M/d/yyyy" TimeFormat="h:mm tt" /> <AppointmentTemplate> <a href='<%#Eval("Link") %>'><%#Eval("Subject")%></a> <%--<a href='CourseDescription.aspx?cid=<%#Eval("ID") %>'><%#Eval("Subject")%></a>--%> </AppointmentTemplate> <monthview visibleappointmentsperday="15" AdaptiveRowHeight="True" /></telerik:RadScheduler>And the code behind is
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ FillCalendar(DateTime.Now); //} } protected void rsCalendar_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e) { FillCalendar(rsCalendar.SelectedDate); } /// <summary> /// Fills the calendar with the info /// </summary> private void FillCalendar(DateTime selDate) { List<CoursesByDate> cal = dbContext.GetCoursesByDate(selDate).ToList(); rsCalendar.DataSource = cal; rsCalendar.DataKeyField = "CourseCode"; rsCalendar.DataSubjectField = "Course_Description"; rsCalendar.DataStartField = "Begin_Date"; rsCalendar.DataEndField = "End_Date"; rsCalendar.DataBind(); }What's wrong?