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

Events

RadPanelBar supports a number of client-side events that let you customize the behavior of the panel bar:

To use these events, simply write a javascript function that can be called when the event occurs. Then assign the name of the javascript function as the value of the the corresponding RadPanelBar property.

ASPNET
<script> 
	function OnClientItemClicking(sender, args) {    
		var item = eventArgs.get_item();    
		var navigateUrl = item.get_navigateUrl();    
		if (navigateUrl && navigateUrl != "#") {       
			var proceed = confirm("Navigate to "+ navigateUrl + " ?");       
			if (!proceed) {          
				eventArgs.set_cancel(true);       
			}       
			else {         
				eventArgs.set_cancel(false);       
			} 
		}
	}
</script>
<telerik:radpanelbar id="RadPanelBar1" runat="server" onclientitemclicking="OnClientItemClicking">
...
</telerik:radpanelbar>

You can also assign event handlers in client-side code. When using the client-side API, pass a reference to the event handler rather than its name. One advantage of using the client-side API is that you can attach multiple event handlers to one event using the standard MS AJAX convention:

JavaScript
	     
function onClickedHandler1()
{ 
    alert("First handler called");
}

function onClickedHandler2()
{
    alert("Second handler called");
}

function pageLoad()
{ 
    var panelBar = $find("<%=RadPanelBar1.ClientID%>");  
    panelBar.add_itemClicked(OnClickedHandler1);
    panelBar.add_itemClicked(OnClickedHandler2);
}
				

Another advantage of the client-side API is that you can detach an event handler dynamically:

JavaScript
	     
function removeOnClicked2() {
    var panelBar = $find("<%=RadPanelBar1.ClientID%>"); 
    panelBar.remove_itemClicked(OnClickedHandler2);
}
				

Note that on the client-side, the names of events are slightly different than on the server side. The following table shows the correspondence between client-side and server-side names:

Server-Side NameClient-SideNameMethods to add and Remove
OnClientLoadloadadd_load, remove_load
OnClientItemClickingitemClickingadd_itemClicking, remove_itemClicking
OnClientItemClickeditemClickedadd_itemClicked, remove_itemClicked
OnClientItemExpanditemExpandadd_itemExpand, remove_itemExpand
OnClientItemCollapseitemCollapseadd_itemCollapse, remove_itemCollapse
OnClientItemBluritemBluradd_itemBlur, remove_itemBlur
OnClientItemFocusitemFocusadd_itemFocus, remove_itemFocus
OnClientMouseOvermouseOveradd_mouseOver, remove_mouseOver
OnClientMouseOutmouseOutadd_mouseOut, remove_mouseOut
OnClientContextMenucontextMenuadd_contextMenu, remove_contextMenu

See Also

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