New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

DefaultViewChanged

The ASP NET AJAX Calendar control provides the DefaultViewChanged server event, which is raised when the AutoPostBack property is set to true, and the user changes the currently visible view using the navigation controls in the title bar.

The DefaultViewChanged event handler receives two arguments:

  1. The RadCalendarcontrol whose view was just changed. This argument is of type object, but can be cast to the RadCalendar type.

  2. A DefaultViewChangedEventArgs object. This object has the following two properties:

    • OldView is the CalendarView object for the view that was current before the change.

    • NewView is the CalendarView object for the current view after the change.

Use the DefaultViewChanged event handler to respond to changes in the dates the calendar displays:

C#
protected void RadCalendar1_DefaultViewChanged(object sender, DefaultViewChangedEventArgs e)
{
    if (e.OldView.ViewStartDate < e.NewView.ViewStartDate)
        Label1.Text = e.OldView.TitleContent + " -> " + e.NewView.TitleContent;
    else
        Label1.Text = e.NewView.TitleContent + " <- " + e.OldView.TitleContent;
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support