I am trying to customize the appointment template in the Monthly view. When I add an appointment template, it displays nothing. I tried placing static text in place of the bound objects and it still didn't display anything. Can somebody take a look an tell me what I am missing?
Code Behind
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="RentalCalendar.aspx.vb" Inherits="HowToRent" %> |
<%@ Register TagPrefix="UsrContent01" TagName="usrCtlMain" Src="~/ClientPages/Calendar.ascx" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> |
<style type="text/css"> |
div.RadScheduler .rsMonthView .rsWrap |
{ |
height: auto; |
font-size: 0; |
min-height: 10px; /* * 4 = empty cell height */ |
line-height:10px; |
} |
div.RadScheduler .rsMonthView .rsDateWrap, |
div.RadScheduler .rsWrap div.rsApt, |
div.RadScheduler .rsRow div.rsShowMore |
{ |
position: relative; |
font: 8px/16px verdana,sans-serif; |
} |
</style> |
<UsrContent01:usrCtlMain ID="UsrCtlMain" runat="server" /> |
<telerik:RadScheduler ID="RadScheduler1" runat="server" |
CustomAttributeNames="SelectedColor,SelectedColor1,PostEvent" |
DataEndField="End" Skin="Web20" |
OverflowBehavior="Expand" |
ShowViewTabs="false" |
SelectedView="MonthView" |
EnableEmbeddedSkins="True" |
AllowEdit="false" |
AllowDelete ="false" |
AllowInsert="false" |
DataKeyField="ID" DataRecurrenceField="RecurrenceRule" |
DataRecurrenceParentKeyField="RecurrenceParentID" |
DataSourceID="AccessDataSource1" DataStartField="Start" |
DataSubjectField="Subject" HoursPanelTimeFormat="htt" |
ValidationGroup="RadScheduler1"> |
<AppointmentTemplate> |
(<asp:Literal ID="AppointmentStartTime" runat="server" Text='<%# Eval("Start", "{0:t}") %>'></asp:Literal> |
- |
<asp:Literal ID="AppoitmentEndTime" runat="server" Text='<%# Eval("End", "{0:t}") %>'></asp:Literal>) |
<asp:Literal ID="AppointmentSubject" runat="server" Text='<%# Eval("Subject") %>'></asp:Literal> |
</AppointmentTemplate> |
</telerik:RadScheduler> |
<asp:AccessDataSource ID="AccessDataSource1" runat="server" |
DataFile="~/App_Data/scheduler1a.mdb" |
DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = ?" |
InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [RoomID], [TypeID], [ResourceID], [Description], [SelectedColor], [SelectedColor1]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" |
SelectCommand="SELECT * FROM [Appointments]" |
UpdateCommand="UPDATE [Appointments] SET [Subject] = ?, [Start] = ?, [End] = ?, [RecurrenceRule] = ?, [RecurrenceParentID] = ?, [RoomID] = ?, [TypeID] = ?, [ResourceID] = ?, [Description] = ?, [SelectedColor] = ?, [SelectedColor1] = ? WHERE [ID] = ?"> |
<DeleteParameters> |
<asp:Parameter Name="ID" Type="Int32" /> |
</DeleteParameters> |
<UpdateParameters> |
<asp:Parameter Name="Subject" Type="String" /> |
<asp:Parameter Name="Start" Type="DateTime" /> |
<asp:Parameter Name="End" Type="DateTime" /> |
<asp:Parameter Name="RecurrenceRule" Type="String" /> |
<asp:Parameter Name="RecurrenceParentID" Type="Int32" /> |
<asp:Parameter Name="RoomID" Type="Int32" /> |
<asp:Parameter Name="TypeID" Type="Int32" /> |
<asp:Parameter Name="ResourceID" Type="Int32" /> |
<asp:Parameter Name="Description" Type="String" /> |
<asp:Parameter Name="SelectedColor" Type="String" /> |
<asp:Parameter Name="SelectedColor1" Type="String" /> |
<asp:Parameter Name="ID" Type="Int32" /> |
</UpdateParameters> |
<InsertParameters> |
<asp:Parameter Name="Subject" Type="String" /> |
<asp:Parameter Name="Start" Type="DateTime" /> |
<asp:Parameter Name="End" Type="DateTime" /> |
<asp:Parameter Name="RecurrenceRule" Type="String" /> |
<asp:Parameter Name="RecurrenceParentID" Type="Int32" /> |
<asp:Parameter Name="RoomID" Type="Int32" /> |
<asp:Parameter Name="TypeID" Type="Int32" /> |
<asp:Parameter Name="ResourceID" Type="Int32" /> |
<asp:Parameter Name="Description" Type="String" /> |
<asp:Parameter Name="SelectedColor" Type="String" /> |
<asp:Parameter Name="SelectedColor1" Type="String" /> |
</InsertParameters> |
</asp:AccessDataSource> |
</asp:Content> |
Imports Telerik.Web.UI |
Imports System.Collections.Generic |
Partial Class HowToRent |
Inherits BasePage |
Protected Sub RadScheduler1_AppointmentCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentCreatedEventArgs) Handles RadScheduler1.AppointmentCreated |
'Dim subj As Label = e.Container.FindControl("apptSubj") |
'subj.Text = e.Appointment.Subject |
End Sub |
Protected Sub RadScheduler1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadScheduler1.PreRender |
If RadScheduler1.SelectedView = SchedulerViewType.MonthView Then |
RadScheduler1.DataBind() |
Dim maxAppointmentsPerDay As Integer = 2 |
Dim currentDay As DateTime = RadScheduler1.VisibleRangeStart |
While currentDay < RadScheduler1.VisibleRangeEnd |
Dim nextDay As DateTime = currentDay.AddDays(1) |
Dim visibleAppointments As IList(Of Appointment) = RadScheduler1.Appointments.GetAppointmentsInRange(currentDay, nextDay) |
maxAppointmentsPerDay = Math.Max(maxAppointmentsPerDay, visibleAppointments.Count) |
currentDay = nextDay |
End While |
RadScheduler1.MonthView.VisibleAppointmentsPerDay = maxAppointmentsPerDay |
End If |
MyBase.OnPreRender(e) |
End Sub |
End Class |