New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("ToolBar", typeof(RadToolBar))]
[EmbeddedSkin("ToolBar", "Default", typeof(RadToolBar))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadToolBar))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[RequiredScript(typeof(Core))]
[RequiredScript(typeof(jQueryPlugins))]
[RequiredScript(typeof(DropDown))]
[RequiredScript(typeof(MaterialRipple))]
[ClientScriptResource("Telerik.Web.UI.RadToolBar", "Telerik.Web.UI.ToolBar.RadToolBarScripts.js")]
[TelerikToolboxCategory("Navigation")]
[ToolboxBitmap(typeof(RadToolBar), "Toolbox.Icons.ToolBar.png")]
public class RadToolBar : ControlItemContainer, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, INamingContainer, IXmlSerializable, IPostBackEventHandler, IRadToolBarItemContainer, IControlItemContainer

Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlControlItemContainerRadToolBar...

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlItemContainerIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIRadToolBarItemContainerIScriptControlISkinnableControlIUrlResolutionServiceIXmlSerializable...

Inherited Members ControlItemContainer.PerformDataBinding(IEnumerable)ControlItemContainer.PrepareForDataBinding()ControlItemContainer.GetXml()ControlItemContainer.LoadXml(string)ControlItemContainer.FindChild<TControlItem>(Predicate<TControlItem>)ControlItemContainer.GetAllChildren<TControlItem>()ControlItemContainer.FindChildByText<TControlItem>(string)ControlItemContainer.FindChildByText<TControlItem>(string, bool)ControlItemContainer.FindChildByAttribute<TControlItem>(string, string)ControlItemContainer.InitializeItem(ControlItem)ControlItemContainer.ReadXml(XmlReader)ControlItemContainer.ReadXmlForChildren(XmlReader)ControlItemContainer.WriteXml(XmlWriter)ControlItemContainer.WriteXmlForChildren(XmlWriter)ControlItemContainer.GetXml(XmlSerializer, TextWriter)ControlItemContainer.LoadXml(ControlItemContainer)ControlItemContainer.LoadViewState(object)ControlItemContainer.SaveViewState()ControlItemContainer.TrackViewState()ControlItemContainer.AppendDataBoundItemsControlItemContainer.DataTextFieldControlItemContainer.DataValueFieldControlItemContainer.DataTextFormatStringControlItemContainer.KeyboardNavigationSettingsControlItemContainer.TemplateControlItemContainer.ChildrenControlItemContainer.TagKeyDataBoundControl.OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)DataBoundControl.CreateDataSourceSelectArguments()DataBoundControl.GetData()DataBoundControl.GetDataSource()DataBoundControl.MarkAsDataBound()DataBoundControl.OnDataPropertyChanged()DataBoundControl.OnDataSourceViewChanged(object, EventArgs)DataBoundControl.OnLoad(EventArgs)DataBoundControl.OnPagePreLoad(object, EventArgs)DataBoundControl.PerformSelect()DataBoundControl.ValidateDataSource(object)DataBoundControl.DataMemberDataBoundControl.IsUsingModelBindersDataBoundControl.ItemTypeDataBoundControl.SelectMethodDataBoundControl.DataSourceIDDataBoundControl.DataSourceObjectDataBoundControl.SelectArgumentsDataBoundControl.CreatingModelDataSourceDataBoundControl.CallingDataMethodsBaseDataBoundControl.ConfirmInitState()BaseDataBoundControl.DataBind()BaseDataBoundControl.EnsureDataBound()BaseDataBoundControl.OnDataBound(EventArgs)BaseDataBoundControl.OnInit(EventArgs)BaseDataBoundControl.OnPreRender(EventArgs)BaseDataBoundControl.DataSourceBaseDataBoundControl.InitializedBaseDataBoundControl.IsBoundUsingDataSourceIDBaseDataBoundControl.IsDataBindingAutomaticBaseDataBoundControl.SupportsDisabledAttributeBaseDataBoundControl.RequiresDataBindingBaseDataBoundControl.DataBoundWebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.DisabledCssClassWebControl.StyleWebControl.EnabledWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SkinIDWebControl.TabIndexWebControl.TagNameWebControl.ToolTipWebControl.WidthControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.CreateChildControls()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
public RadToolBar()

Properties

Gets or sets a value indicating whether button items should postback when clicked.

C#
public bool AutoPostBack { get; set; }
Property Value:

True if button items should postback; otherwise false. The default value is false.

RadToolBar will postback provided one of the following conditions is met:

Gets or sets a value indicating whether validation is performed when a button item within the RadToolBar control is clicked.

C#
[ClientControlProperty]
[ClientPropertyName("causesValidation")]
public override bool CausesValidation { get; set; }
Property Value:

true if validation is performed when a button item is clicked; otherwise, false. The default value is true.

Overrides: ControlItemContainer.CausesValidation

By default, page validation is performed when a button item is clicked. Page validation determines whether the input controls associated with a validation control on the page all pass the validation rules specified by the validation control. You can specify or determine whether validation is performed on both the client and the server when a tab is clicked by using the CausesValidation property. To prevent validation from being performed, set the CausesValidation property to false.

Gets a list of all client-side changes (adding an item, removing an item, changing an item's property) which have occurred.

C#
[Browsable(false)]
public IList<ClientOperation<RadToolBarItem>> ClientChanges { get; }
Property Value:

A list of ClientOperation<T> objects which represent all client-side changes the user has performed. By default the ClientChanges property returns empty list. Client-changes are recorded if and only if the client-side methods trackChanges()/commitChanges() have been invoked.

You can use the ClientChanges property to respond to client-side modifications such as

  • adding a new item
  • removing existing item
  • clearing the children of an item or the control itself
  • changing a property of the item

The ClientChanges property is available in the first postback (ajax) request after the client-side modifications have taken place. After this moment the property will return empty list.

Example:
cs-api-definition
foreach (ClientOperation&lt;RadToolBarItem&gt; operation in RadToolBar1.ClientChanges)
{
RadToolBarItem item = operation.Item;

switch (operation.Type)
{
case ClientOperationType.Insert:
//An item has been inserted - operation.Item contains the inserted item
break;
case ClientOperationType.Remove:
//An item has been inserted - operation.Item contains the removed item.
//Keep in mind the item has been removed from the toolbar.
break;
case ClientOperationType.Update:
UpdateClientOperation&lt;RadToolBarItem&gt; update = operation as UpdateClientOperation&lt;RadToolBarItem&gt;
//The "UpdateOperation" provides an additional property "PropertyName". This is the property whose value was changed from the client side.
break;
case ClientOperationType.Clear:
//All children of have been removed - operation.Item contains the parent item whose children have been removed. If operation.Item is null then the root items have been removed.
break;
}
}

Gets the settings for the animation played when a dropdown closes.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings CollapseAnimation { get; }
Property Value:

An AnimationSettings that represents the collapse animation.

Use the CollapseAnimation property to customize the collapse animation of the RadToolBar dropdown items - RadToolBarDropDown and RadToolBarSplitButton. You can specify the Type and the Duration of the collapse animation. To disable collapse animation effects you should set the Type to AnimationType.None.
To customize the expand animation you can use the ExpandAnimation property.

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadToolBar1.CollapseAnimation.Type = AnimationType.Linear;
RadToolBar1.CollapseAnimation.Duration = 300;
}

Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.

C#
[ClientControlProperty]
[ClientPropertyName("_cssClass")]
public override string CssClass { get; set; }
Property Value:

The CSS class rendered by the Web server control on the client. The default is Empty.

Overrides: RadDataBoundControl.CssClass

The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()

C#
protected override string CssClassFormatString { get; }

Overrides: RadDataBoundControl.CssClassFormatString

Example:
C#
protected override string CssClassFormatString
{
       get
       {
           return "RadDock RadDock_{0} rdWTitle rdWFooter";
       }
}

Gets or sets a value indicating whether item images should have sprite support.

C#
[ClientControlProperty]
[ClientPropertyName("enableImageSprites")]
public bool EnableImageSprites { get; set; }
Property Value:

True if the child items should have sprite support; otherwise False. The default value is False.

Gets or sets a value indicating whether child items should have rounded corners.

C#
[ClientControlProperty]
[ClientPropertyName("enableRoundedCorners")]
public bool EnableRoundedCorners { get; set; }
Property Value:

True if the child items should have rounded corners; otherwise false. The default value is false.

Gets or sets a value indicating whether child items should have shadows.

C#
[ClientControlProperty]
[ClientPropertyName("enableShadows")]
public bool EnableShadows { get; set; }
Property Value:

True if the child items should have shadows; otherwise false. The default value is false.

Gets the settings for the animation played when a dropdown opens.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings ExpandAnimation { get; }
Property Value:

An AnimationSettings that represents the expand animation.

Use the ExpandAnimation property to customize the expand animation of the RadToolBar dropdown items - RadToolBarDropDown and RadToolBarSplitButton. You can specify the Type and the Duration of the expand animation. To disable expand animation effects you should set the Type to AnimationType.None.
To customize the collapse animation you can use the CollapseAnimation property.

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadToolBar1.ExpandAnimation.Type = AnimationType.Linear;
RadToolBar1.ExpandAnimation.Duration = 300;
}

Gets a collection of RadToolBarItem objects representing the individual items within the RadToolBar.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadToolBarItemCollection Items { get; }
Property Value:

A RadToolBarItemCollection that contains a collection of RadToolBarItem objects representing the individual items within the RadToolBar.

Implements: IRadToolBarItemContainer.Items

Use the Items collection to programmatically control the items in the RadToolBar control.

Example:
C#
The following example demonstrates how to declare a <xref href="Telerik.Web.UI.RadToolBar?text=RadToolBar" data-throw-if-not-resolved="false"></xref>
   with different items.

<p>
       &lt;telerik:RadToolBar ID="RadToolBar1" runat="server"&gt;
           &lt;Items&gt;
               &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/CreateNew.gif"
                   Text="Create new" CommandName="CreateNew"/&gt;
               &lt;telerik:RadToolBarButton IsSeparator="true" /&gt;
               &lt;telerik:RadToolBarDropDown ImageUrl="~/ToolbarImages/Manage.gif" Text="Manage"&gt;
                   &lt;Buttons&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolbarImages/ManageUsers.gif"
                           Text="Users" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolbarImages/ManageOrders.gif"
                           Text="Orders" /&gt;
                   &lt;/Buttons&gt;
               &lt;/telerik:RadToolBarDropDown&gt;
               &lt;telerik:RadToolBarSplitButton ImageUrl="~/ToolBarImages/RegisterPurchase.gif"
                   Text="Register Purchase"&gt;
                   &lt;Buttons&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterCachePurchase.gif"
                           Text="Cache Purchase" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterCheckPurchase.gif"
                           Text="Check Purchase" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterDirectBankPurchase.gif"
                           Text="Bank Purchase" /&gt;
                   &lt;/Buttons&gt;
               &lt;/telerik:RadToolBarSplitButton&gt;
           &lt;/Items&gt;
       &lt;/telerik:RadToolBar&gt;
   </p>

Gets or sets a value indicating the client-side event handler that is called after clicking a button item (RadToolBarButton or RadToolBarSplitButton).

C#
[ClientControlEvent]
[ClientPropertyName("buttonClicked")]
public string OnClientButtonClicked { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientButtonClicked property to specify a JavaScript function that will be executed after a button is clicked - either by left-clicking it with the mouse or hitting enter after tabbing to that button item.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with two properties
    • item - the instance of the clicked button
    • domEvent - the reference to the browser DOM event
Example:
C#
The following example demonstrates how to use the
<strong>OnClientButtonClicked</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientButtonClicked</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var button = eventArgs.get_item();<br />
        <br />
           alert(String.format("You clicked the '{0}' button in the '{1}' toolBar.",
               button.get_text(), toolBar.get_id()));<br />
    }<br />
    &lt;/script&gt;</p>

    <telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientButtonClicked="clientButtonClicked"</strong>><br />
    <Items><br />
           <telerik:RadToolBarButton Text="Left"></telerik:RadToolBarButton><br />
           <telerik:RadToolBarButton Text="Center"></telerik:RadToolBarButton><br />
           <telerik:RadToolBarButton Text="Right"></telerik:RadToolBarButton><br />
           <telerik:RadToolBarDropDown Text="Align"><br />
               <Buttons><br />
                   <telerik:RadToolBarButton Text="Left"></telerik:RadToolBarButton><br />
                   <telerik:RadToolBarButton Text="Center"></telerik:RadToolBarButton><br />
                   <telerik:RadToolBarButton Text="Right"></telerik:RadToolBarButton><br />
               </Buttons><br />
           </telerik:RadToolBarDropDown><br />
           <telerik:RadToolBarSplitButton Text="Right"><br />
               <Buttons><br />
                   <telerik:RadToolBarButton Text="Left"></telerik:RadToolBarButton><br />
                   <telerik:RadToolBarButton Text="Center"></telerik:RadToolBarButton><br />
                   <telerik:RadToolBarButton Text="Right"></telerik:RadToolBarButton><br />
               </Buttons><br />
           </telerik:RadToolBarSplitButton><br />
    </Items><br />
    </telerik:RadToolBar></p>

Gets or sets a value indicating the client-side event handler that is called just prior to clicking a toolbar button item (RadToolBarButton or RadToolBarSplitButton).

C#
[ClientControlEvent]
[ClientPropertyName("buttonClicking")]
public string OnClientButtonClicking { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientButtonClicking property to specify a JavaScript function that will be executed prior to button item clicking - either by left-clicking it with the mouse or hitting enter after tabbing to that button. You can cancel that event (prevent button clicking) by seting the cancel property of the event argument to true.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with three properties
    • item - the instance of the button item being clicked
    • cancel - whether to cancel the event
    • domEvent - the reference to the browser DOM event
Example:
C#
The following example demonstrates how to use the
<strong>OnClientButtonClicking</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientButtonClicking</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var button = eventArgs.get_item();<br />
        <br />
           alert("You are clicking the '" + button.get_text() + "' button in the '" + toolBar.get_id() +
    "' toolBar.");<br />
        <br />
           if (button.get_text() == "Right")<br />
           {<br />
               alert("Right alignment is not available");<br />
            <strong>eventArgs.set_cancel(true);</strong><br />
           }<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientButtonClicking="clientButtonClicking"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Right"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called after a RadToolBarButton is checked.

C#
[ClientControlEvent]
[ClientPropertyName("checkedStateChanged")]
public string OnClientCheckedStateChanged { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientCheckedStateChanged property to specify a JavaScript function that will be executed after a toolbar dropdown button is checked - either by left-clicking a checkable button or pressing the ENTER key after tabbing to that button.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with two properties
    • item - the instance of the button which is checked
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as button.toggle())
Example:
C#
The following example demonstrates how to use the
<strong>OnClientCheckedStateChanged</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientCheckedStateChanged</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var button = eventArgs.get_item();<br />
        <br />
           alert(String.format("You just changed the checked state of the '{0}' button in the '{1}' toolBar.",
               button.get_text(), toolBar.get_id()));<br />
        <br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientCheckedStateChanged="clientCheckedStateChanged"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Reset"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called just prior to changing the state of a checkable RadToolBarButton.

C#
[ClientControlEvent]
[ClientPropertyName("checkedStateChanging")]
public string OnClientCheckedStateChanging { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientCheckedStateChanging property to specify a JavaScript function that will be executed prior to button checked state changing - either by left-clicking a checkable button or pressing the ENTER key after tabbing to that button. You can cancel that event (prevent button checked state changing) by seting the cancel property of the event argument to true.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with three properties
    • item - the instance of the button which checked state is being changed
    • cancel - whether to cancel the event
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as button.toggle())
Example:
C#
The following example demonstrates how to use the
<strong>OnClientCheckedStateChanging</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientCheckedStateChanging</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var button = eventArgs.get_item();<br />
        <br />
           alert(String.format("You are about to change the checked state of the '{0}' button in the '{1}' toolBar.",
               button.get_text(), toolBar.get_id()));<br />
        <br />
           if (item.get_text() == "Left" &amp;&amp; item.get_group() == "Align")<br />
           {<br />
               alert("You cannot change the checked state of the 'Align Left' button!");<br />
            <strong>eventArgs.set_cancel(true);</strong><br />
           }<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientCheckedStateChanging="clientCheckedStateChanging"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Reset"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right" CheckOnClick="true" Group="Align" &gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called before the browser context menu shows (after right-clicking an item).

C#
[ClientControlEvent]
[ClientPropertyName("contextMenu")]
public string OnClientContextMenu { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientContextMenu property to specify a JavaScript function that will be executed before the context menu shows after right clicking an item.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with two properties
    • item - the instance of the selected toolbar item
    • domEvent - the reference to the browser DOM event
Example:
C#
The following example demonstrates how to use the
<strong>OnClientContextMenu</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>onContextMenuHandler</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var item = eventArgs.get_item();<br />
        <br />
           alert(String.format("You have right-clicked the {0} item in the {1} toolBar.", item.get_text(), toolBar.get_id());<br />
    }<br />
    &lt;/script&gt;</p>
    <p>&lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientContextMenu="onContextMenuHandler"</strong>&gt;<br />
    &lt;Items&gt;<br />
    &lt;telerik:RadToolBarButton Text="Bold"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Italic"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Underline"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called after a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton) is closed.

C#
[ClientControlEvent]
[ClientPropertyName("dropDownClosed")]
public string OnClientDropDownClosed { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientDropDownClosed property to specify a JavaScript function that will be executed after a toolbar dropdown item is closed - either by left-clicking an open dropdown with the mouse, hitting the ESC key when the dropdown or a button in it is focused, or clicking a non-checkable button in the dropdown.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with two properties
    • item - the instance of the dropdown item which is closed
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as dropDownItem.hideDropDown())
Example:
C#
The following example demonstrates how to use the
<strong>OnClientDropDownClosed</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientDropDownClosed</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var dropDownItem = eventArgs.get_item();<br />
        <br />
           alert("You just closed the '" + dropDownItem.get_text() + "' dropDown in the '" + toolBar.get_id() +
    "' toolBar.");<br />
        <br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientDropDownClosed="clientDropDownClosed"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Right"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called just prior to closing a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton).

C#
[ClientControlEvent]
[ClientPropertyName("dropDownClosing")]
public string OnClientDropDownClosing { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientDropDownClosing property to specify a JavaScript function that will be executed prior to dropdown item closing - either by left-clicking an open dropdown with the mouse, hitting the ESC key when the dropdown or a button in it is focused, or clicking a non-checkable button in the dropdown. You can cancel that event (prevent dropdown closing) by seting the cancel property of the event argument to true.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with three properties
    • item - the instance of the dropdown item being closed
    • cancel - whether to cancel the event
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as dropDownItem.hideDropDown())
Example:
C#
The following example demonstrates how to use the
<strong>OnClientDropDownClosing</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientDropDownClosing</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var dropDownItem = eventArgs.get_item();<br />
        <br />
           alert("You are about to close the '" + dropDownItem.get_text() + "' dropDown in the '" + toolBar.get_id() +
    "' toolBar.");<br />
        <br />
           if (dropDownItem.get_text() == "Align")<br />
           {<br />
               alert("You cannot close the Align dropdown!");<br />
            <strong>eventArgs.set_cancel(true);</strong><br />
           }<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientDropDownClosing="clientDropDownClosing"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Right"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called after a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton) is opened.

C#
[ClientControlEvent]
[ClientPropertyName("dropDownOpened")]
public string OnClientDropDownOpened { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientDropDownOpened property to specify a JavaScript function that will be executed after a toolbar dropdown item is opened - either by left-clicking it with the mouse or hitting the down arrow after tabbing to that item.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with two properties
    • item - the instance of the dropdown item which is opened
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as dropDownItem.showDropDown())
Example:
C#
The following example demonstrates how to use the
<strong>OnClientDropDownOpened</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientDropDownOpened</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var dropDownItem = eventArgs.get_item();<br />
        <br />
           alert("You just opened the '" + dropDownItem.get_text() + "' dropDown in the '" + toolBar.get_id() +
    "' toolBar.");<br />
        <br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientDropDownOpened="clientDropDownOpened"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Right"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called just prior to opening a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton).

C#
[ClientControlEvent]
[ClientPropertyName("dropDownOpening")]
public string OnClientDropDownOpening { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientDropDownOpening property to specify a JavaScript function that will be executed prior to dropdown item opening - either by left-clicking it with the mouse or hitting the down arrow after tabbing to that item. You can cancel that event (prevent dropdown opening) by seting the cancel property of the event argument to true.

Two parameters are passed to the handler

  • sender (the client-side RadToolBar object)
  • eventArgs with three properties
    • item - the instance of the dropdown item being opened
    • cancel - whether to cancel the event
    • domEvent - the reference to the browser DOM event (null if the event was initiated by calling a client-side method such as dropDownItem.showDropDown();)
Example:
C#
The following example demonstrates how to use the
<strong>OnClientDropDownOpening</strong> property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>clientDropDownOpening</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var dropDownItem = eventArgs.get_item();<br />
        <br />
           alert("You are opening the '" + dropDownItem.get_text() + "' dropDown in the '" + toolBar.get_id() +
    "' toolBar.");<br />
        <br />
           if (dropDownItem.get_text() == "Align")<br />
           {<br />
               alert("Alignment is not available");<br />
            <strong>eventArgs.set_cancel(true);</strong><br />
           }<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientDropDownOpening="clientDropDownOpening"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Right"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets the name of the javascript function called when the control is fully initialized on the client side.

C#
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
Property Value:

A string specifying the name of the javascript function called when the control is fully initialized on the client side. The default value is empty string.

Use the OnClientLoad property to specify a JavaScript function that is executed after the control is initialized on the client side. A single parameter is passed to the handler, which is the client-side RadToolBar object.

Example:
C#
The following example demonstrates how to use the <strong>OnClientLoad</strong>
property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>onClientToolBarLoad</strong>(toolBar, eventArgs)<br />
    {<br />
           alert(toolBar.get_id() + " is loaded.");<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientButtonClicking="onButtonClicking"</strong>&gt;<br />
    &lt;Items&gt;<br />
           &lt;telerik:RadToolBarButton Text="Save"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarButton Text="Load"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
           &lt;telerik:RadToolBarDropDown Text="Align"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Left"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Center"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Right"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarDropDown&gt;<br />
           &lt;telerik:RadToolBarSplitButton Text="Apply Color (Red)"&gt;<br />
               &lt;Buttons&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Red"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Yellow"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
                   &lt;telerik:RadToolBarButton Text="Blue"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
               &lt;/Buttons&gt;<br />
           &lt;/telerik:RadToolBarSplitButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>
</p>

Gets or sets a value indicating the client-side event handler that is called when the mouse leaves an item in the RadToolBar control.

C#
[ClientControlEvent]
[ClientPropertyName("mouseOut")]
public string OnClientMouseOut { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientMouseOut property to specify a JavaScript function that is executed whenever the user moves the mouse away from a particular item in the RadToolBar control.

Two parameters are passed to the handler:

  • sender (the client-side RadToolBar object);
  • eventArgs with two properties:
    • item - the instance of the item which the mouse is moving away from;
    • domEvent - the reference to the browser DOM event
Example:
C#
The following example demonstrates how to use the <strong>OnClientMouseOut</strong>
property.

<p>
    <p>&lt;script language="javascript"&gt;<br />
    function <strong>onClientMouseOut</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var item = eventArgs.get_item();<br />
           var domEvent = eventArgs.get_domEvent();
        alert(String.format("You have just moved out of '{0}' item in the {1} toolBar.",
               item.get_text(), toolBar.get_id()));<br />
           alert(String.format("Mouse coordinates: \n\nx = {0}\ny = {1}",
               domEvent.clientX, domEvent.clientY));<br />
    }<br />
    &lt;/script&gt;<br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientMouseOut="onClientMouseOut"</strong>&gt;<br />
    &lt;Items&gt;<br />
    &lt;telerik:RadToolBarButton Text="Bold"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Italic"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Underline"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;
</p>
   </p>

Gets or sets a value indicating the client-side event handler that is called when the mouse hovers an item in the RadToolBar control.

C#
[ClientControlEvent]
[ClientPropertyName("mouseOver")]
public string OnClientMouseOver { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

Use the OnClientMouseOver property to specify a JavaScript function that is called when the user hovers an item with the mouse.

Two parameters are passed to the handler:

  • sender (the client-side RadToolBar object);
  • eventArgs with two properties
    • item - the instance of the toolbar item that is being hovered
    • domEvent - the reference to the browser DOM event
Example:
C#
The following example demonstrates how to use the
<strong>OnClientMouseOver</strong> property.

<p>
    &lt;script language="javascript"&gt;<br />
    function <strong>onClientMouseOver</strong>(sender, eventArgs)<br />
    {<br />
           var toolBar = sender;<br />
           var item = eventArgs.get_item();<br />
           var domEvent = eventArgs.get_domEvent();<br />
        <br />
           alert(String.format("You have just moved over the {0} item in the {1} toolBar", item.get_text(), toolBar.get_id());<br />
           alert(String.format("Mouse coordinates: \n\nx = {0};\ny = {1}", domEvent.clientX, domEvent.clientY));<br />
    }<br />
    &lt;/script&gt;<br />
        <br />
    &lt;telerik:RadToolBar id="RadToolBar1" runat="server"
    <strong>OnClientMouseOver="onClientMouseOver"</strong>&gt;<br />
    &lt;Items&gt;<br />
    &lt;telerik:RadToolBarButton Text="Bold"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Italic"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;telerik:RadToolBarButton Text="Underline"&gt;&lt;/telerik:RadToolBarButton&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadToolBar&gt;</p>

Gets or sets the direction in which to render the RadToolBar control.

C#
[ClientControlProperty]
[ClientPropertyName("orientation")]
public Orientation Orientation { get; set; }
Property Value:

One of the Orientation enumeration values. The default is Orientation.Horizontal.

Use the Orientation property to specify the direction in which to render the RadToolBar control. The following table lists the available directions.

OrientationDescription
Orientation.HorizontalThe RadToolBar control is rendered horizontally.
Orientation.VerticalThe RadToolBar control is rendered vertically.
Example:
C#
The following example demonstrates how to use the Orientation property
   to display a vertical <xref href="Telerik.Web.UI.RadToolBar?text=RadToolBar" data-throw-if-not-resolved="false"></xref>.

<p>
       &lt;telerik:RadToolBar ID="RadToolBar1" runat="server"&gt;
           &lt;Items&gt;
               &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/CreateNew.gif"
                   Text="Create new" CommandName="CreateNew"/&gt;
               &lt;telerik:RadToolBarButton IsSeparator="true" /&gt;
               &lt;telerik:RadToolBarDropDown ImageUrl="~/ToolbarImages/Manage.gif" Text="Manage"&gt;
                   &lt;Buttons&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolbarImages/ManageUsers.gif"
                           Text="Users" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolbarImages/ManageOrders.gif"
                           Text="Orders" /&gt;
                   &lt;/Buttons&gt;
               &lt;/telerik:RadToolBarDropDown&gt;
               &lt;telerik:RadToolBarSplitButton ImageUrl="~/ToolBarImages/RegisterPurchase.gif"
                   Text="Register Purchase"&gt;
                   &lt;Buttons&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterCachePurchase.gif"
                           Text="Cache Purchase" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterCheckPurchase.gif"
                           Text="Check Purchase" /&gt;
                       &lt;telerik:RadToolBarButton ImageUrl="~/ToolBarImages/RegisterDirectBankPurchase.gif"
                           Text="Bank Purchase" /&gt;
                   &lt;/Buttons&gt;
               &lt;/telerik:RadToolBarSplitButton&gt;
           &lt;/Items&gt;
       &lt;/telerik:RadToolBar&gt;
   </p>

Gets or sets the URL of the page to post to from the current page when a button item from the RadToolBar control is clicked.

C#
[ClientControlProperty]
[ClientPropertyName("postBackUrl")]
public override string PostBackUrl { get; set; }
Property Value:

The URL of the Web page to post to from the current page when a tab from the tabstrip control is clicked. The default value is an empty string (""), which causes the page to post back to itself.

Overrides: ControlItemContainer.PostBackUrl

C#
protected override IRenderer Renderer { get; }

Overrides: RadDataBoundControl.Renderer

Gets or Sets SingleClick state

C#
public virtual ToolBarSingleClick SingleClick { get; set; }
C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadDataBoundControl.SupportsRenderingMode

Gets or sets the name of the validation group to which this validation control belongs.

C#
[ClientControlProperty]
[ClientPropertyName("validationGroup")]
public override string ValidationGroup { get; set; }
Property Value:

The name of the validation group to which this validation control belongs. The default is an empty string (""), which indicates that this property is not set.

Overrides: ControlItemContainer.ValidationGroup

This property works only when CausesValidation is set to true.

Methods

C#
protected override void AddAttributesToRender(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDataBoundControl.AddAttributesToRender(HtmlTextWriter)

C#
protected override ControlItemCollection CreateChildItemCollection()
Returns:

ControlItemCollection

Overrides: ControlItemContainer.CreateChildItemCollection()

C#
protected override IRenderer CreateControlRenderer()
Returns:

IRenderer

Overrides: RadDataBoundControl.CreateControlRenderer()

C#
protected override ControlItem CreateItem()
Returns:

ControlItem

Overrides: ControlItemContainer.CreateItem()

C#
protected override ControlItem CreateItem(ClientStateLogEntry logEntry)
Parameters:logEntryClientStateLogEntryReturns:

ControlItem

Overrides: ControlItemContainer.CreateItem(ClientStateLogEntry)

C#
protected override void DescribeClientEvents(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDataBoundControl.DescribeClientEvents(IScriptDescriptor)

C#
protected override void DescribeClientProperties(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDataBoundControl.DescribeClientProperties(IScriptDescriptor)

C#
protected override void DescribeComponent(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: ControlItemContainer.DescribeComponent(IScriptDescriptor)

Searches the RadToolBar control for the first IRadToolBarButton CommandName property is equal to the specified value.

C#
public IRadToolBarButton FindButtonByCommandName(string commandName)
Parameters:commandNamestring

The commandName to search for.

Returns:

IRadToolBarButton

A IRadToolBarButton which CommandName property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Finds the child by value.

C#
public override TControlItem FindChildByValue<TControlItem>(string value, bool ignoreCase) where TControlItem : ControlItem
Parameters:valuestring

The value.

ignoreCasebool

The ignore case.

Returns:

TControlItem

Overrides: ControlItemContainer.FindChildByValue<TControlItem>(string, bool)

Finds the child by value.

C#
public override TControlItem FindChildByValue<TControlItem>(string value) where TControlItem : ControlItem
Parameters:valuestring

The value.

Returns:

TControlItem

Overrides: ControlItemContainer.FindChildByValue<TControlItem>(string)

Searches the RadToolBar control for the first RadToolBarDropDown which Value property is equal to the specified value.

C#
public RadToolBarDropDown FindDropDownByValue(string value, bool ignoreCase)
Parameters:valuestring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

RadToolBarDropDown

A RadToolBarDropDown which Value property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Searches the RadToolBar control for the first RadToolBarDropDown which Value property is equal to the specified value.

C#
public RadToolBarDropDown FindDropDownByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

RadToolBarDropDown

A RadToolBarDropDown which Value property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Returns the first RadToolBarItem that matches the conditions defined by the specified predicate. The predicate should returns a boolean value.

C#
public RadToolBarItem FindItem(Predicate<RadToolBarItem> match)
Parameters:matchPredicate<RadToolBarItem>

The Predicate <> that defines the conditions of the element to search for.

Returns:

RadToolBarItem

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadToolBar1.FindItem(ItemWithEqualsTextAndValue);
}
private static bool ItemWithEqualsTextAndValue(RadToolBarItem item)
{
if (item.Text == item.Value)
{
return true;
}
else
{
return false;
}
}
C#
protected override ControlItem FindItemByHierarchicalIndex(string hierarchicalIndex)
Parameters:hierarchicalIndexstringReturns:

ControlItem

Overrides: ControlItemContainer.FindItemByHierarchicalIndex(string)

Searches the RadToolBar control for the first RadToolBarItem whose Text property is equal to the specified value.

C#
public RadToolBarItem FindItemByText(string text, bool ignoreCase)
Parameters:textstring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

RadToolBarItem

A RadToolBarItem whose Text property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Searches the RadToolBar control for the first RadToolBarItem whose Text property is equal to the specified value.

C#
public RadToolBarItem FindItemByText(string text)
Parameters:textstring

The value to search for.

Returns:

RadToolBarItem

A RadToolBarItem whose Text property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Searches the RadToolBar control for the first RadToolBarButton or RadToolBarSplitButton which NavigateUrl property is equal to the specified value.

C#
public RadToolBarItem FindItemByUrl(string url)
Parameters:urlstring

The url to search for.

Returns:

RadToolBarItem

A RadToolBarButton or RadToolBarSplitButton which NavigateUrl property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Searches the RadToolBar control for the first RadToolBarButton or RadToolBarSplitButton which Value property is equal to the specified value.

C#
public RadToolBarItem FindItemByValue(string value, bool ignoreCase)
Parameters:valuestring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

RadToolBarItem

A RadToolBarButton or RadToolBarSplitButton which Value property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Searches the RadToolBar control for the first RadToolBarButton or RadToolBarSplitButton which Value property is equal to the specified value.

C#
public RadToolBarItem FindItemByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

RadToolBarItem

A RadToolBarButton or RadToolBarSplitButton which Value property is equal to the specified value. If an item is not found, null (Nothing in Visual Basic) is returned.

Gets a linear list of all toolbar items in the RadToolBar control.

C#
public IList<RadToolBarItem> GetAllItems()
Returns:

IList<RadToolBarItem>

An IList<T> object containing all items in the current RadToolBar control.

Gets the checked button which belongs to the specified group in the RadToolBar control

C#
public RadToolBarButton GetCheckedGroupButton(string group)
Parameters:groupstring

The name of the group to search for.

Returns:

RadToolBarButton

A RadToolBarButton object which CheckOnClick and Checked properties are set to true.

Gets a linear list of all toolbar buttons in the RadToolBar control, which belong to the specified group

C#
public IList<RadToolBarButton> GetGroupButtons(string group)
Parameters:groupstring

The name of the group to search for.

Returns:

IList<RadToolBarButton>

An IList<T> object containing all the buttons in the current RadToolBar control, which belong to the specified group.

C#
protected override Type GetItemTypeFromXmlTagName(string xmlTagName)
Parameters:xmlTagNamestringReturns:

Type

Overrides: ControlItemContainer.GetItemTypeFromXmlTagName(string)

C#
protected override string GetPostbackEventReference()
Returns:

string

Overrides: ControlItemContainer.GetPostbackEventReference()

Populates the RadToolBar control from external XML file.

C#
public void LoadContentFile(string xmlFileName)
Parameters:xmlFileNamestring

The name of the XML file.

The newly added items will be appended after any existing ones.

Example:
cs-api-definition
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadToolBar1.LoadContentFile("~/ToolBarData.xml");
}
}

Executed when post data is loaded from the request

C#
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Parameters:postDataKeystringpostCollectionNameValueCollectionReturns:

bool

Overrides: RadDataBoundControl.LoadPostData(string, NameValueCollection)

C#
protected virtual void OnButtonClick(RadToolBarEventArgs e)
Parameters:eRadToolBarEventArgs
C#
protected virtual void OnItemCreated(RadToolBarEventArgs e)
Parameters:eRadToolBarEventArgs
C#
protected virtual void OnItemDataBound(RadToolBarButtonEventArgs e)
Parameters:eRadToolBarButtonEventArgs
C#
protected virtual void OnTemplateNeeded(RadToolBarEventArgs e)
Parameters:eRadToolBarEventArgs
C#
protected override void RaiseItemCreated(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseItemCreated(ControlItem)

C#
protected override void RaiseItemDataBound(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseItemDataBound(ControlItem)

C#
protected virtual void RaisePostBackEvent(string eventArgument)
Parameters:eventArgumentstring
C#
protected override void RaiseTemplateNeeded(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseTemplateNeeded(ControlItem)

C#
protected override void RenderContents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDataBoundControl.RenderContents(HtmlTextWriter)

Events

Occurs on the server when a button or in the RadToolBar control is clicked.

C#
public event RadToolBarEventHandler ButtonClick
Example:
cs-api-definition
protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarButtonEventArgs e)
{
Label1.Text = "Clicked button is " + e.Item.Text;
}

Occurs when a button is data bound.

C#
public event RadToolBarButtonEventHandler ButtonDataBound

The ButtonDataBound event is raised for each button upon databinding. You can retrieve the button being bound using the event arguments. The DataItem associated with the button can be retrieved using the DataItem property.

The ButtonDataBound event is often used in scenarios when you want to perform additional mapping of fields from the DataItem to their respective properties in the RadToolBarButton class.

Example:
cs-api-definition
protected void RadToolBar1_ButtonDataBound(object sender, Telerik.Web.UI.RadToolBarButtonEventArgs e)
{
e.Button.ImageUrl = "~/ToolBarImages/tool" + (string)DataBinder.Eval(e.Button.DataItem, "Text") + ".gif";
e.Button.NavigateUrl = (string)DataBinder.Eval(e.Button.DataItem, "URL");
}

Occurs when a toolbar item is created.

C#
public event RadToolBarEventHandler ItemCreated

The ItemCreated event is raised when an item in the RadToolBar control is created, both during round-trips and at the time data is bound to the control. The ItemCreated event is not raised for items which are defined inline in the page or user control.

The ItemCreated event is commonly used to initialize item properties.

Example:
cs-api-definition
protected void RadToolBar1_ItemCreated(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
e.Item.ToolTip = e.Item.Text;
}

Occurs before template is being applied to the item.

C#
public event RadToolBarEventHandler TemplateNeeded

The TemplateNeeded event is raised before a template is been applied on the item, both during round-trips (postbacks) and at the time data is bound to the control. The TemplateNeeded event is not raised for items which are defined inline in the page or user control.

The TemplateNeeded event is commonly used for dynamic templating.

Example:
cs-api-definition
protected void RadToolBar1_TemplateNeeded(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
string value = e.Item.Value;
if (value != null)
{
// if the value is an even number
if ((Int32.Parse(value) % 2) == 0)
{
var textBoxTemplate = new TextBoxTemplate();
textBoxTemplate.InstantiateIn(e.Item);
}
}
}
In this article
DefinitionConstructorsRadToolBar()PropertiesAutoPostBackCausesValidationClientChangesCollapseAnimationCssClassCssClassFormatStringEnableImageSpritesEnableRoundedCornersEnableShadowsExpandAnimationItemsOnClientButtonClickedOnClientButtonClickingOnClientCheckedStateChangedOnClientCheckedStateChangingOnClientContextMenuOnClientDropDownClosedOnClientDropDownClosingOnClientDropDownOpenedOnClientDropDownOpeningOnClientLoadOnClientMouseOutOnClientMouseOverOrientationPostBackUrlRendererSingleClickSupportsRenderingModeValidationGroupMethodsAddAttributesToRender(HtmlTextWriter)CreateChildItemCollection()CreateControlRenderer()CreateItem()CreateItem(ClientStateLogEntry)DescribeClientEvents(IScriptDescriptor)DescribeClientProperties(IScriptDescriptor)DescribeComponent(IScriptDescriptor)FindButtonByCommandName(string)FindChildByValue<TControlItem>(string, bool)FindChildByValue<TControlItem>(string)FindDropDownByValue(string, bool)FindDropDownByValue(string)FindItem(Predicate<RadToolBarItem>)FindItemByHierarchicalIndex(string)FindItemByText(string, bool)FindItemByText(string)FindItemByUrl(string)FindItemByValue(string, bool)FindItemByValue(string)GetAllItems()GetCheckedGroupButton(string)GetGroupButtons(string)GetItemTypeFromXmlTagName(string)GetPostbackEventReference()LoadContentFile(string)LoadPostData(string, NameValueCollection)OnButtonClick(RadToolBarEventArgs)OnItemCreated(RadToolBarEventArgs)OnItemDataBound(RadToolBarButtonEventArgs)OnTemplateNeeded(RadToolBarEventArgs)RaiseItemCreated(ControlItem)RaiseItemDataBound(ControlItem)RaisePostBackEvent(string)RaiseTemplateNeeded(ControlItem)RenderContents(HtmlTextWriter)EventsButtonClickButtonDataBoundItemCreatedTemplateNeeded
Not finding the help you need?
Contact Support