RadToolBar
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[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:
Inherited Members
Constructors
public RadToolBar()
Properties
Gets or sets a value indicating whether button items should postback when clicked.
public bool AutoPostBack { get; set; }
True if button items should postback; otherwise false. The default
value is false.
RadToolBar will postback provided one of the following conditions is met:
- The AutoPostBack property is set to
true.- The user has subscribed to the ButtonClick event.
Gets or sets a value indicating whether validation is performed when a button item within the RadToolBar control is clicked.
[ClientControlProperty]
[ClientPropertyName("causesValidation")]
public override bool CausesValidation { get; set; }
true if validation is performed when a button item is clicked; otherwise, false. The default value is true.
Overrides:
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.
[Browsable(false)]
public IList<ClientOperation<RadToolBarItem>> ClientChanges { get; }
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.
Gets the settings for the animation played when a dropdown closes.
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings CollapseAnimation { get; }
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.
Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.
[ClientControlProperty]
[ClientPropertyName("_cssClass")]
public override string CssClass { get; set; }
The CSS class rendered by the Web server control on the client. The default is Empty.
Overrides:
The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()
protected override string CssClassFormatString { get; }
Overrides:
Gets or sets a value indicating whether item images should have sprite support.
[ClientControlProperty]
[ClientPropertyName("enableImageSprites")]
public bool EnableImageSprites { get; set; }
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.
[ClientControlProperty]
[ClientPropertyName("enableRoundedCorners")]
public bool EnableRoundedCorners { get; set; }
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.
[ClientControlProperty]
[ClientPropertyName("enableShadows")]
public bool EnableShadows { get; set; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings ExpandAnimation { get; }
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.
Gets a collection of RadToolBarItem objects representing the individual items within the RadToolBar.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadToolBarItemCollection Items { get; }
A RadToolBarItemCollection that contains a collection of RadToolBarItem objects representing the individual items within the RadToolBar.
Implements:
Use the Items collection to programmatically control the items in the RadToolBar control.
Gets or sets a value indicating the client-side event handler that is called after clicking a button item (RadToolBarButton or RadToolBarSplitButton).
[ClientControlEvent]
[ClientPropertyName("buttonClicked")]
public string OnClientButtonClicked { get; set; }
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
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).
[ClientControlEvent]
[ClientPropertyName("buttonClicking")]
public string OnClientButtonClicking { get; set; }
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
Gets or sets a value indicating the client-side event handler that is called after a RadToolBarButton is checked.
[ClientControlEvent]
[ClientPropertyName("checkedStateChanged")]
public string OnClientCheckedStateChanged { get; set; }
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())
Gets or sets a value indicating the client-side event handler that is called just prior to changing the state of a checkable RadToolBarButton.
[ClientControlEvent]
[ClientPropertyName("checkedStateChanging")]
public string OnClientCheckedStateChanging { get; set; }
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())
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).
[ClientControlEvent]
[ClientPropertyName("contextMenu")]
public string OnClientContextMenu { get; set; }
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
Gets or sets a value indicating the client-side event handler that is called after a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton) is closed.
[ClientControlEvent]
[ClientPropertyName("dropDownClosed")]
public string OnClientDropDownClosed { get; set; }
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())
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).
[ClientControlEvent]
[ClientPropertyName("dropDownClosing")]
public string OnClientDropDownClosing { get; set; }
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())
Gets or sets a value indicating the client-side event handler that is called after a toolbar dropdown item (RadToolBarDropDown or RadToolBarSplitButton) is opened.
[ClientControlEvent]
[ClientPropertyName("dropDownOpened")]
public string OnClientDropDownOpened { get; set; }
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())
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).
[ClientControlEvent]
[ClientPropertyName("dropDownOpening")]
public string OnClientDropDownOpening { get; set; }
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();)
Gets or sets the name of the javascript function called when the control is fully initialized on the client side.
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
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.
Gets or sets a value indicating the client-side event handler that is called when the mouse leaves an item in the RadToolBar control.
[ClientControlEvent]
[ClientPropertyName("mouseOut")]
public string OnClientMouseOut { get; set; }
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
Gets or sets a value indicating the client-side event handler that is called when the mouse hovers an item in the RadToolBar control.
[ClientControlEvent]
[ClientPropertyName("mouseOver")]
public string OnClientMouseOver { get; set; }
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
Gets or sets the direction in which to render the RadToolBar control.
[ClientControlProperty]
[ClientPropertyName("orientation")]
public Orientation Orientation { get; set; }
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.
Orientation Description Orientation.Horizontal The RadToolBar control is rendered horizontally. Orientation.Vertical The RadToolBar control is rendered vertically.
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.
[ClientControlProperty]
[ClientPropertyName("postBackUrl")]
public override string PostBackUrl { get; set; }
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:
Gets or Sets SingleClick state
public virtual ToolBarSingleClick SingleClick { get; set; }
protected override bool SupportsRenderingMode { get; }
Overrides:
Gets or sets the name of the validation group to which this validation control belongs.
[ClientControlProperty]
[ClientPropertyName("validationGroup")]
public override string ValidationGroup { get; set; }
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:
This property works only when CausesValidation is set to true.
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
protected override ControlItemCollection CreateChildItemCollection()
Overrides:
protected override ControlItem CreateItem(ClientStateLogEntry logEntry)
Overrides:
protected override void DescribeClientEvents(IScriptDescriptor descriptor)
Overrides:
protected override void DescribeClientProperties(IScriptDescriptor descriptor)
Overrides:
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
Searches the RadToolBar control for the first IRadToolBarButton CommandName property is equal to the specified value.
public IRadToolBarButton FindButtonByCommandName(string commandName)
The commandName to search for.
Returns: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.
public override TControlItem FindChildByValue<TControlItem>(string value) where TControlItem : ControlItem
The value.
Returns:TControlItem
Overrides:
Searches the RadToolBar control for the first RadToolBarDropDown which Value property is equal to the specified value.
public RadToolBarDropDown FindDropDownByValue(string value, bool ignoreCase)
The value to search for.
ignoreCaseboolA Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).
Returns: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.
public RadToolBarDropDown FindDropDownByValue(string value)
The value to search for.
Returns: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.
public RadToolBarItem FindItem(Predicate<RadToolBarItem> match)
The Predicate <> that defines the conditions of the element to search for.
Returns:protected override ControlItem FindItemByHierarchicalIndex(string hierarchicalIndex)
Overrides:
Searches the RadToolBar control for the first RadToolBarItem whose Text property is equal to the specified value.
public RadToolBarItem FindItemByText(string text, bool ignoreCase)
The value to search for.
ignoreCaseboolA Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).
Returns: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.
public RadToolBarItem FindItemByText(string text)
The value to search for.
Returns: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.
public RadToolBarItem FindItemByUrl(string url)
The url to search for.
Returns: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.
public RadToolBarItem FindItemByValue(string value, bool ignoreCase)
The value to search for.
ignoreCaseboolA Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).
Returns: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.
public RadToolBarItem FindItemByValue(string value)
The value to search for.
Returns: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.
public IList<RadToolBarItem> GetAllItems()
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
public RadToolBarButton GetCheckedGroupButton(string group)
The name of the group to search for.
Returns: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
Populates the RadToolBar control from external XML file.
public void LoadContentFile(string xmlFileName)
The name of the XML file.
The newly added items will be appended after any existing ones.
Executed when post data is loaded from the request
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Overrides:
protected virtual void OnItemDataBound(RadToolBarButtonEventArgs e)
protected override void RaiseItemDataBound(ControlItem item)
Overrides:
protected override void RaiseTemplateNeeded(ControlItem item)
Overrides:
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
Events
Occurs on the server when a button or in the RadToolBar control is clicked.
public event RadToolBarEventHandler ButtonClick
Occurs when a button is data bound.
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.
Occurs when a toolbar item is created.
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.
Occurs before template is being applied to the item.
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.