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

Server-Side Events

November 2024
Event log

In this example we demonstrate the two main server-side events of the ASP.NET AJAX Calendar:

  • DefaultViewChanged - it fires when the default rendered view of the calendar is changed (navigate to another view).
  • SelectionChanged - it fires if a date is selected and the AutoPostback property is set to true.
  • HeaderCellRender - it fires after the generation of every calendar header cell object and just before it gets rendered to the client if some of the properties ShowRowHeaders, ShowColumnHeaders or EnableViewSelector is set to true.

There is also one additional server-side event: DayRender - it fires after all the cells of the calendar are generated and just before it is rendered to the client.
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" AutoEventWireup="false" Inherits="Telerik.Web.Examples.Calendar.Programming.ServerSideEvents.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
        <div class="demo-container" runat="server" id="containerDiv">
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadCalendar1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1"></telerik:AjaxUpdatedControl>
                            <telerik:AjaxUpdatedControl ControlID="EventLogConsole1"></telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadCalendar RenderMode="Lightweight" ID="RadCalendar1" runat="server" TitleFormat="MMMM yyyy" CultureInfo="English (United States)"
                AutoPostBack="true" OnSelectionChanged="SelectedDateChange" OnDefaultViewChanged="NavigationChanged">
            </telerik:RadCalendar>
        </div>
    </div>
    <qsf:EventLogConsole runat="server" ID="EventLogConsole1"></qsf:EventLogConsole>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance