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

RadToolBar Object

The following table lists the most important methods of the RadToolBar client-side object:

Client side changes are available on the server side after postback. You can use the ClientChanges property to access them.

NameParametersReturn TypeDescription
trackChangesnonenoneBegins tracking changes to the toolbar items. Only changes to the items that occur between a call to trackChanges and commitChanges persist after a postback. (see Example 1)
commitChangesnonenoneEnds tracking changes to the toolbar items. Only changes to the items that occur between a call to trackChanges and commitChanges persist after a postback. (see Example 1)
findItemByTextstringRadToolBarItemReturns the first item in the toolbar with the specified text.
findItemByAttributestring, stringRadToolBarItemReturns the first item in the toolbar with the custom attribute specified by the first parameter set to the value specified by the second parameter.
findItemByValuestringRadToolBarItemReturns the first item in the toolbar with the specified value.
get_attributesnoneAttributesReturns the collection of custom attributes defined for the toolbar.
get_itemsnoneRadToolBarItemCollectionReturns the collection of items in the toolbar (not including items in drop-down lists).
get_allItemsnoneArray of RadToolBarItemReturns an array containing all the items in the toolbar, including the items in drop-down lists. Items in drop-down lists appear immediately following their parent items.
get_orientationnoneintegerReturns 0 if the toolbar is horizontal, 1 if it is vertical.
set_orientationintegernoneSets the orientation of the toolbar.
get_expandAnimationnoneAnimationReturns the expand animation object.
get_collapseAnimationnoneAnimationReturns the collapse animation object.
get_elementnoneHTML elementGets the DOM element for the toolbar.
get_childListElementnoneHTML elementGets the DOM element for the UL element that lists the toolbar buttons.
add_<EventName>eventHandlernoneAttaches an eventHandler to the event with the name <EventName>. Note that client-side event names differ from their server-side counterparts. For more information, see Client-Side Events.
remove_<EventName>eventHandlerBooleanDetaches an eventHandler from the event with the name <EventName>.Returns "True" if the eventHandler is found and detached, false otherwise.Note that client-side event names differ from their server-side counterparts. For more information, see Client-Side Events.

Example 1: Demonstrates the usage of trackChanges() and commitChanges() methods.

JavaScript
var toolBar = $find("<%=RadToolBar1.ClientID %>");
var dropDownButton = toolBar.get_items().getItem(0);
toolBar.trackChanges();
var dropDownChildButton = new Telerik.Web.UI.RadToolBarButton();
dropDownChildButton.set_text("Added on the client-side button");
dropDownButton.get_buttons().add(dropDownChildButton);
toolBar.commitChanges();				
Not finding the help you need?
Contact Support