Edit this page

SelectionChanged

The RadCalendar control provides the SelectionChanged server event, which is raised when the AutoPostBack property is set to true, and the user changes the current selection by selecting or unselecting a date in the calendar.

The SelectionChanged event handler receives two arguments:

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

  2. A SelectedDatesEventArgs object. This object has a SelectedDates property which is a collection that lists all the dates in the current selection.

Use the SelectionChanged event handler to respond to changes in the calendar's selection:

protected void RadCalendar1_SelectionChanged(object sender, SelectedDatesEventArgs e)
{
    Label1.Text = "Selected dates are:<br />";
    for (int i = 0; i < e.SelectedDates.Count; i++)
    {
        Label1.Text += (e.SelectedDates[i]).Date.ToString() + ",<br />";
    }
}
Protected Sub RadCalendar1_SelectionChanged(ByVal sender As Object, ByVal e As SelectedDatesEventArgs) Handles RadCalendar1.SelectionChanged
    Label1.Text = "Selected dates are:<br />"
    Dim i As Integer = 0
    While i < e.SelectedDates.Count
        Label1.Text += (e.SelectedDates(i)).[Date].ToString() + ",<br />"
        System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
    End While
End Sub

See Also