New to Telerik UI for ASP.NET AJAX? Start 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.
Name | Parameters | Return Type | Description |
---|---|---|---|
trackChanges | none | none | Begins 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) |
commitChanges | none | none | Ends 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) |
findItemByText | string | RadToolBarItem | Returns the first item in the toolbar with the specified text. |
findItemByAttribute | string, string | RadToolBarItem | Returns the first item in the toolbar with the custom attribute specified by the first parameter set to the value specified by the second parameter. |
findItemByValue | string | RadToolBarItem | Returns the first item in the toolbar with the specified value. |
get_attributes | none | Attributes | Returns the collection of custom attributes defined for the toolbar. |
get_items | none | RadToolBarItemCollection | Returns the collection of items in the toolbar (not including items in drop-down lists). |
get_allItems | none | Array of RadToolBarItem | Returns 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_orientation | none | integer | Returns 0 if the toolbar is horizontal, 1 if it is vertical. |
set_orientation | integer | none | Sets the orientation of the toolbar. |
get_expandAnimation | none | Animation | Returns the expand animation object. |
get_collapseAnimation | none | Animation | Returns the collapse animation object. |
get_element | none | HTML element | Gets the DOM element for the toolbar. |
get_childListElement | none | HTML element | Gets the DOM element for the UL element that lists the toolbar buttons. |
add_<EventName> | eventHandler | none | Attaches 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> | eventHandler | Boolean | Detaches 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();