Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Calendar / Special Days and templates

<<<November 2024>>>
Autumn
SunMonTueWedThuFriSat
     12
3456789
1011
date
13141516
mortgage
18
date
20212223
24252627282930
       

  • The following example demonstrates 3 features of Telerik RadCalendar:

    1. Using a custom non-embedded skin
    2. Special day templates - RadCalendar provides a collection of dynamic templates that customize the presentation of calendar days on a "per day" basis. The templates can contain regular HTML and are particularly useful if you want to implement a scheduler-like interface with extra information, such as images illustrating events, links to additional sources, etc.
    3. Header and Footer templates - You can specify different content for the templates of different months and change them from the code-behind. Here, images are changed for every season.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Calendar.Functionality.SpecialDays.DefaultCS" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <link href="Common/Calendar.Special.css" rel="stylesheet" type="text/css" />
        <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag>
    </head>
    <body class="BODY">
        <form id="mainForm" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="CS" ShowSkinChooser="false">
        </qsf:Header>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadCalendar1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadCalendar1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="true" Skin="Special"
            EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" EnableMonthYearFastNavigation="false" DayNameFormat="Short"
            ShowRowHeaders="false" ShowOtherMonthsDays="false" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged">
            <HeaderTemplate>
                <asp:Image ID="HeaderImage" runat="server" Width="757" Height="94" Style="display: block" />
            </HeaderTemplate>
            <FooterTemplate>
                <asp:Image ID="FooterImage" runat="server" Width="757" Height="70" Style="display: block" />
            </FooterTemplate>
            <SpecialDays>
                <telerik:RadCalendarDay Date="2009/06/12" Repeatable="DayInMonth" TemplateID="DateTemplate" />
                <telerik:RadCalendarDay Date="2009/06/19" Repeatable="DayInMonth" TemplateID="DateTemplate" />
                <telerik:RadCalendarDay Date="2009/06/17" Repeatable="DayInMonth" TemplateID="MortgageTemplate" />
                <telerik:RadCalendarDay Date="2009/06/8" Repeatable="DayAndMonth" TemplateID="BirthdayTemplate" />
                <telerik:RadCalendarDay Date="2009/08/7" Repeatable="DayAndMonth" TemplateID="BirthdayTemplate" />
                <telerik:RadCalendarDay Date="2009/10/8" Repeatable="DayAndMonth" TemplateID="BirthdayTemplate" />
                <telerik:RadCalendarDay Date="2009/12/23" Repeatable="DayAndMonth" TemplateID="BirthdayTemplate" />
                <telerik:RadCalendarDay Date="2010/2/14" Repeatable="DayAndMonth" TemplateID="BirthdayTemplate" />
            </SpecialDays>
            <CalendarDayTemplates>
                <telerik:DayTemplate ID="DateTemplate" runat="server">
                    <Content>
                        <div class="rcTemplate rcDayDate">
                            date
                        </div>
                    </Content>
                </telerik:DayTemplate>
                <telerik:DayTemplate ID="MortgageTemplate" runat="server">
                    <Content>
                        <div class="rcTemplate rcDayMortgage">
                            mortgage
                        </div>
                    </Content>
                </telerik:DayTemplate>
                <telerik:DayTemplate ID="BirthdayTemplate" runat="server">
                    <Content>
                        <div class="rcTemplate rcDayBirthday">
                            birthday
                        </div>
                    </Content>
                </telerik:DayTemplate>
            </CalendarDayTemplates>
        </telerik:RadCalendar>
        <qsf:Footer ID="Footer1" runat="server" AdditionalCodeViewerFiles="~/Calendar/Examples/Functionality/SpecialDays/Common/Calendar.Special.css"></qsf:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451