New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Templates

  • today
April 2012
April 2012
SMTWTFS
       
1234567
891011121314
15161718192021
22232425262728
2930     
Monday, April 16, 2012
  • Day
  • Week
all day
8AM
9AM
10AM
11AM
12PM
1PM
2PM
3PM
4PM
5PM

hty

asasd

test

baburiba123

fff

Show 24 hours...
  • Edit
  • Delete
  • New Appointment
  • New Recurring Appointment
  • Go to today
  • Show 24 hours...

You can use templates to customize the edit form and the way appointments are rendered in RadScheduler. This example uses the following:

  • AppointmentTemplate:   to customize the way appointments render.
  • InlineInsertTemplate:   to customize the inline insert form.
  • InlineEditTemplate:   to customize the inline edit form.
  • AdvancedEditTemplate:   to customize the advanced edit form.
  • AdvancedInsertTemplate:   to customize the advanced insert form.

It also uses the FormCreated event to set default values of controls inside the templates.

Important: For the sake of simplicity the advanced insert/edit templates in this example do not support Modal mode. Please see Use custom modal advanced template and the Advanced Templates demo for more information on how to enable such support in your templates.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Scheduler.Examples.Templates.DefaultCS" %>

<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript" src="scripts.js"></script>
    </telerik:RadScriptBlock>
    <div class="demo-container no-bg">
        <telerik:RadScheduler RenderMode="Lightweight" runat="server" ID="RadScheduler1" SelectedDate="2012-04-16"
            DayStartTime="08:00:00" DayEndTime="18:00:00" ShowViewTabs="true" StartEditingInAdvancedForm="false"
            DataSourceID="AppointmentsDataSource" DataKeyField="ID" DataSubjectField="Subject"
            DataStartField="Start" DataEndField="End" DataRecurrenceField="RecurrenceRule"
            DataRecurrenceParentKeyField="RecurrenceParentID" OnAppointmentCommand="RadScheduler1_AppointmentCommand"
            OnFormCreated="RadScheduler1_FormCreated" OnFormCreating="RadScheduler1_FormCreating"
            OnAppointmentCreated="RadScheduler1_AppointmentCreated">
            <TimelineView UserSelectable="false" />
            <MonthView UserSelectable="false" />
            <ResourceTypes>
                <telerik:ResourceType KeyField="ID" Name="AppointmentType" TextField="Keyword" ForeignKeyField="AppointmentTypeID"
                    DataSourceID="AppointmentTypesDataSource"></telerik:ResourceType>
            </ResourceTypes>
            <ResourceStyles>
                <telerik:ResourceStyleMapping Type="AppointmentType" Text="technical" ApplyCssClass="rsCategoryGreen"></telerik:ResourceStyleMapping>
                <telerik:ResourceStyleMapping Type="AppointmentType" Text="specification_review"
                    ApplyCssClass="rsCategoryOrange"></telerik:ResourceStyleMapping>
                <telerik:ResourceStyleMapping Type="AppointmentType" Text="code_review" ApplyCssClass="rsCategoryBlue"></telerik:ResourceStyleMapping>
            </ResourceStyles>
            <InlineInsertTemplate>
                <div id="InlineInsertTemplate" class="rsCustomAppointmentContainer technical">
                    <div>
                    </div>
                    <span class="rsCustomAppointmentContainerInner">
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%"
                            TextMode="MultiLine" Height="20px"></asp:TextBox>
                        <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                            <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.png" AlternateText="insert"></asp:Image>
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                            <asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.png" AlternateText="cancel"></asp:Image>
                        </asp:LinkButton>
                        <span class="inline-label">Color code:</span>
                        <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" DataValueField="ID"
                            CssClass="AppointmentTypeSelectorTable" DataSourceID="AppointmentTypesDataSource"
                            SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
                            DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}'></span>">
                        </asp:RadioButtonList>
                        <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
                    </span>
                </div>
            </InlineInsertTemplate>
            <InlineEditTemplate>
                <div id="InlineEditTemplate" class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>">
                    <div>
                    </div>
                    <span class="rsCustomAppointmentContainerInner">
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%"
                            TextMode="MultiLine" Height="20px"></asp:TextBox>
                        <asp:LinkButton ID="InsertButton" runat="server" CommandName="Update">
                            <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.png" AlternateText="update"></asp:Image>
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                            <asp:Image runat="server" ID="Image3" ImageUrl="Images/cancel.png" AlternateText="cancel"></asp:Image>
                        </asp:LinkButton>
                        <span class="inline-label">Color code:</span>
                        <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" DataValueField="ID"
                            CssClass="AppointmentTypeSelectorTable" DataSourceID="AppointmentTypesDataSource"
                            SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
                            DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}'></span>">
                        </asp:RadioButtonList>
                        <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
                    </span>
                </div>
            </InlineEditTemplate>
            <AppointmentTemplate>
                <div class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>">
                    <h2>
                        <%# Eval("Subject") %>
                    </h2>
                    <div>
                    </div>
                </div>
            </AppointmentTemplate>
            <AdvancedEditTemplate>
                <div id="qsfexAdvEditWrapper">
                    <div id="qsfexAdvEditInnerWrapper" class='<%# Eval("AppointmentType.Text") %>'>
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="TitleTextBox" runat="server" CssClass="inline-label">Description</asp:Label>
                            <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="StartInput" runat="server" CssClass="inline-label">Start time:</asp:Label>
                            <telerik:RadDateInput RenderMode="Lightweight" ID="StartInput" SelectedDate='<%# Bind("Start") %>' runat="server"
                                _enableoldboxmodel="true" EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="EndInput" runat="server" CssClass="inline-label">End time:</asp:Label>
                            <telerik:RadDateInput RenderMode="Lightweight" ID="EndInput" SelectedDate='<%# Bind("End") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <div class="inline-label">
                                Color code:
                            </div>
                            <div id="qsfexAdvEditColorCodeChooser">
                                <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" DataValueField="ID"
                                    CssClass="AppointmentTypeSelectorTable" DataSourceID="AppointmentTypesDataSource"
                                    SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
                                    DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}'></span>">
                                </asp:RadioButtonList>
                            </div>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:CheckBox ID="RepeatCheckBox" runat="server" Text="Repeat for 10 days" CssClass="repeatCheckBox"></asp:CheckBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper" style="text-align: right;">
                            <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update">
                                <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.png" AlternateText="update"></asp:Image>
                            </asp:LinkButton>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.png" AlternateText="cancel"></asp:Image>
                            </asp:LinkButton>
                        </div>
                    </div>
                </div>
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <div id="qsfexAdvEditWrapper">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="TitleTextBox" runat="server" CssClass="inline-label">Description</asp:Label>
                            <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="StartInput" runat="server" CssClass="inline-label">Start time:</asp:Label>
                            <telerik:RadDateInput RenderMode="Lightweight" ID="StartInput" SelectedDate='<%# Bind("Start") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label AssociatedControlID="EndInput" runat="server" CssClass="inline-label">End time:</asp:Label>
                            <telerik:RadDateInput RenderMode="Lightweight" ID="EndInput" SelectedDate='<%# Bind("End") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <div class="inline-label">
                                Color code:
                            </div>
                            <div id="qsfexAdvEditColorCodeChooser">
                                <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" DataValueField="ID"
                                    CssClass="AppointmentTypeSelectorTable" DataSourceID="AppointmentTypesDataSource"
                                    SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
                                    DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}'></span>">
                                </asp:RadioButtonList>
                            </div>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:CheckBox ID="RepeatCheckBox" runat="server" Text="Repeat for 10 days" CssClass="repeatCheckBox"></asp:CheckBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper" style="text-align: right;">
                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                <asp:Image runat="server" ID="Image4" ImageUrl="Images/ok.png" AlternateText="update"></asp:Image>
                            </asp:LinkButton>
                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="Images/cancel.png" AlternateText="cancel"></asp:Image>
                            </asp:LinkButton>
                        </div>
                    </div>
                </div>
            </AdvancedInsertTemplate>
            <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
            <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
        </telerik:RadScheduler>
    </div>
    <asp:SqlDataSource ID="AppointmentsDataSource" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString35 %>"
        SelectCommand="SELECT * FROM [Templates_Appointments]" InsertCommand="INSERT INTO [Templates_Appointments] ([Subject], [Start], [End], [AppointmentTypeID], [RecurrenceRule], [RecurrenceParentID]) VALUES (@Subject, @Start, @End, @AppointmentTypeID, @RecurrenceRule, @RecurrenceParentID)"
        UpdateCommand="UPDATE [Templates_Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [AppointmentTypeID] = @AppointmentTypeID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE (ID = @ID)"
        DeleteCommand="DELETE FROM [Templates_Appointments] WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="Subject" Type="String"></asp:Parameter>
            <asp:Parameter Name="Start" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="End" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="AppointmentTypeID" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="RecurrenceRule" Type="String"></asp:Parameter>
            <asp:Parameter Name="RecurrenceParentID" Type="Int32"></asp:Parameter>
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Subject" Type="String"></asp:Parameter>
            <asp:Parameter Name="Start" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="End" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="AppointmentTypeID" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="RecurrenceRule" Type="String"></asp:Parameter>
            <asp:Parameter Name="RecurrenceParentID" Type="Int32"></asp:Parameter>
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="AppointmentTypesDataSource" runat="server"
        ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString35 %>"
        SelectCommand="SELECT * FROM [Templates_AppointmentTypes]">
    </asp:SqlDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance