OnYearSelected
The OnYearSelected client-side event handler is called immediately after a user select an year cell in the MonthYearView.
The OnYearSelected event is supported by: RadMonthYearPicker .
The event handler receives two arguments:
the RadMonthYearPicker object that fired the event.
an event arguments object that exposes the following methods:OnYearSelected event arguments object
Name | Return Type | Arguments | Description |
---|---|---|---|
get_newDate() | Date object | Returns the new value of the control as a Date object. | |
get_oldDate() | Date object | Returns the old value of the control as a Date object. | |
get_selectedCell() | HTML element | Returns the DOM element for the cell that was clicked. |
The following example uses the OnYearSelected event to display the previous and the new selected year:
<telerik:RadMonthYearPicker RenderMode="Lightweight" ID="RadMonthYearPicker1" runat="server">
<ClientEvents OnYearSelected="OnYearSelected" />
</telerik:RadMonthYearPicker>
function OnYearSelected(sender, eventArgs) {
var newYear = eventArgs.get_newDate().getFullYear();
var oldYear = eventArgs.get_oldDate().getFullYear();
alert("The old selected year was: " + oldYear + ", and the new selected year is: " + newYear);
}