# OnViewSelectorClick

The **OnViewSelectorClick** client-side event handler of the [ASP NET AJAX Calendar](https://www.telerik.com/products/aspnet-ajax/calendar.aspx) is called when the user is about to select an entire view of dates by clicking on the view selector. The event occurs only if the **EnableViewSelector** property is set to **true**.

The event handler receives two arguments:

1. the [RadCalendar object](https://www.telerik.com/products/aspnet-ajax/documentation/controls/calendar/client-side-programming/radcalendar-object) that fired the event.

2. an event arguments object that exposes the following methods:OnViewSelectorClick event arguments object

| Name                  | Return Type  | Arguments | Description                                                                             |
| --------------------- | ------------ | --------- | --------------------------------------------------------------------------------------- |
| **get_domElement()**  | HTML element |           | Returns the DOM element for the view selector                                           |
| **set_cancel(value)** |              | bool      | Lets you prevent the click from selecting or unselecting the dates in the current view. |

The following example uses the **OnViewSelectorClick** event to confirm the selection and, if the selection proceeds, to change the appearance of the view selector:

```ASPNET
<telerik:RadCalendar RenderMode="Lightweight" ID="RadCalendar1" runat="server" EnableViewSelector="True" >
    <ClientEvents OnViewSelectorClick="ConfirmSelection" />
</telerik:RadCalendar>	
```

```JavaScript
function ConfirmSelection(sender, eventArgs) {
	eventArgs.set_cancel(!confirm("Do you want to change the selection for the entire view?"));
	
	var dom;
	
	if (!eventArgs.get_cancel()) {
		dom = eventArgs.get_domElement();
		if (dom.innerText == "x")
			dom.innerText = "-";
		else
			dom.innerText = "x";
	}
}
```

## See Also

* [OnColumnHeaderClick](https://www.telerik.com/products/aspnet-ajax/documentation/controls/calendar/client-side-programming/events/oncolumnheaderclick)

* [OnRowHeaderClick](https://www.telerik.com/products/aspnet-ajax/documentation/controls/calendar/client-side-programming/events/onrowheaderclick)

* [OnDateClick](https://www.telerik.com/products/aspnet-ajax/documentation/controls/calendar/client-side-programming/events/ondateclick)
