RadMenu
The RadMenu control is used to display a list of menu items in a Web Forms page. The RadMenu control supports the following features:
- Databinding that allows the control to be populated from various datasources.
- Programmatic access to the RadMenu object model which allows dynamic creation of menus, populating with items and customizing the behavior by various properties.
- Customizable appearance through built-in or user-defined skins.
Items
The RadMenu control is made up of tree of items represented by RadMenuItem objects. Items at the top level (level 0) are called root items. An item that has a parent item is called a child item. All root items are stored in the Items property of the RadMenu control. Child items are stored in the Items property of their parent RadMenuItem.
Each menu item has a Text and a Value property. The value of the Text property is displayed in the RadMenu control, while the Value property is used to store any additional data about the item, such as data passed to the postback event associated with the item. When clicked, an item can navigate to another Web page indicated by the NavigateUrl property.
You can find information on the Server-side API of RadMenu at .
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[RequiredScript(typeof(Core), 1)]
[RequiredScript(typeof(jQueryPlugins), 2)]
[RequiredScript(typeof(ScrollingScripts), 3)]
[RequiredScript(typeof(OData), 4)]
[RequiredScript(typeof(MaterialRipple))]
[RequiredScript(typeof(AnimationFramework), 5)]
[ClientScriptResource("Telerik.Web.UI.RadMenu", "Telerik.Web.UI.Menu.RadMenuScripts.js", LoadOrder = 6)]
[EmbeddedSkin("Menu", typeof(RadMenu))]
[EmbeddedSkin("Menu", "Default", typeof(RadMenu))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadMenu))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Mobile, typeof(RadMenu))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Mobile, typeof(RadButton))]
[ControlValueProperty("SelectedValue")]
[ValidationProperty("SelectedValue")]
[TelerikToolboxCategory("Navigation")]
[ToolboxBitmap(typeof(RadMenu), "Toolbox.Icons.Menu.png")]
public class RadMenu : HierarchicalControlItemContainer, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, INamingContainer, IXmlSerializable, IControlItemContainer, IRadMenuItemContainer, IPostBackEventHandler
Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlControlItemContainerHierarchicalControlItemContainerRadMenu...
Derived Classes:
Implements:
Inherited Members
Constructors
public RadMenu()
Properties
Gets the object that controls the Wai-Aria settings applied on the control's input element.
[PersistenceMode(PersistenceMode.InnerProperty)]
public WaiAriaSettings AriaSettings { get; }
The minimum available height that is needed to enable the auto-scroll.
[ClientControlProperty]
[ClientPropertyName("autoScrollMinimumHeight")]
public int AutoScrollMinimumHeight { get; set; }
Enabling the auto-scroll when there is very little available space can lead to a situation where only the scroll arrows are visible.
If the available space is lower than the specified value, the menu will attempt to screen boundary detection first (if enabled).
The minimum available width that is needed to enable the auto-scroll.
[ClientControlProperty]
[ClientPropertyName("autoScrollMinimumWidth")]
public int AutoScrollMinimumWidth { get; set; }
The minimum width measured in pixels. The default value is 50 pixels.
Enabling the auto-scroll when there is very little available space can lead to a situation where only the scroll arrows are visible.
If the available space is lower than the specified value, the menu will attempt to screen boundary detection first (if enabled).
Will be serialized to the client, so it can render the UL element with of the root group with the appropriate class.
[ClientControlProperty]
[ClientPropertyName("_childListElementCssClass")]
protected string ChildListElementCssClass { get; set; }
Gets or sets a value indicating whether root items should open on mouse click.
[ClientControlProperty]
[ClientPropertyName("clickToOpen")]
public bool ClickToOpen { get; set; }
True if the root items open on mouse click; otherwise false. The default value is false.
Use the ClickToOpen property to customize the way root menu items are opened. By default menu items are opened on mouse hovering.
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<RadMenuItem>> 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 or sets the template for displaying the items in RadMenu.
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public virtual string ClientItemTemplate { get; set; }
Gets the settings for the animation played when an item closes.
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings CollapseAnimation { get; }
An AnimationSettings that represents the collapse animation.
Use the CollapseAnimation property to customize the expand animation of RadMenu. You can specify the Type, Duration and the items are collapsed.
To disable expand animation effects you should set the Type to AnimationType.None. To customize the expand animation you can use the ExpandAnimation property.
Gets or sets a value indicating the timeout after which a menu item starts to close.
[ClientControlProperty]
[ClientPropertyName("collapseDelay")]
public int CollapseDelay { get; set; }
An integer specifying the timeout measured in milliseconds. The default value is 500 (half a second).
Use the CollapseDelay property to delay item closing. To cause immediate item closing set this property to 0 (zero).
To customize the timeout prior to item closing use the ExpandDelay property.
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 a collection of RadMenuItemBinding objects that define the relationship between a data item and the menu item it is binding to.
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public RadMenuItemBindingCollection DataBindings { get; }
A RadMenuItemBindingCollection that represents the relationship between a data item and the menu item it is binding to.
Specifies the default settings for child item behavior.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadMenuItemGroupSettings DefaultGroupSettings { get; }
An instance of the RadMenuItemGroupSettings class.
You can customize the following settings
- item flow
- expand direction
- horizontal offset from the parent item
- vertical offset from the parent item
- width
- height
For more information check RadMenuItemGroupSettings.
When set to true enables support for WAI-ARIA.
[ClientControlProperty]
[ClientPropertyName("enableAriaSupport")]
public bool EnableAriaSupport { get; set; }
Gets or sets a value indicating if an automatic scroll is applied if the groups are larger then the screen height.
[ClientControlProperty]
[ClientPropertyName("enableAutoScroll")]
public bool EnableAutoScroll { get; set; }
Gets or sets a value indicating whether items images should be preloaded.
[ClientControlProperty]
[ClientPropertyName("_enableItemImagesPreloading")]
public bool EnableImagePreloading { get; set; }
True if items images should be preloaded; otherwise false. The default value is false.
Gets or sets a value indicating whether item images should have sprite support.
[ClientControlProperty]
[ClientPropertyName("enableImageSprites")]
public virtual 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 if an overlay should be rendered (only in Internet Explorer).
[ClientControlProperty]
[ClientPropertyName("enableOverlay")]
public bool EnableOverlay { get; set; }
The overlay is an iframe element that is used to hide select and other elements from overlapping the menu.
Gets or sets a value indicating if scroll is enabled for the root items. Width must be set for horizontal root group, Height for vertical one.
[ClientControlProperty]
[ClientPropertyName("enableRootItemScroll")]
public bool EnableRootItemScroll { get; set; }
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 the screen boundary detection will be applied when menu items are expanded.
[ClientControlProperty]
[ClientPropertyName("enableScreenBoundaryDetection")]
public bool EnableScreenBoundaryDetection { get; set; }
By default RadMenu will check if there is enough space to open a menu item. If there isn't the expand direction of the item will be inverted - Left to Right, Bottom to Top and vice versa.
Gets or sets a value indicating if the currently selected item will be tracked and highlighted.
[ClientControlProperty]
[ClientPropertyName("enableSelection")]
public virtual bool EnableSelection { get; set; }
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 or sets a value indicating whether the html encoding will be applied when the menu items are rendered.
public bool EnableTextHTMLEncoding { get; set; }
By default RadMenu will not apply a html encoding when the menu items are rendered.
Gets the settings for the animation played when an item 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 RadMenu. 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 or sets a value indicating the timeout after which a menu item starts to open.
[ClientControlProperty]
[ClientPropertyName("expandDelay")]
public int ExpandDelay { get; set; }
An integer specifying the timeout measured in milliseconds. The default value is 100 milliseconds.
Use the ExpandDelay property to delay item opening.
To customize the timeout prior to item closing use the CollapseDelay property.
Gets or sets a value indicating the way top level items will flow.
[ClientControlProperty]
[ClientPropertyName("_flow")]
public virtual ItemFlow Flow { get; set; }
One of the ItemFlow values. The default value for top level items is Horizontal.
Use the Flow property to customize the way top level items are displayed. If set to Horizontal items are positioned one after another. Vertical causes the items to flow one below the other.
Gets a RadMenuItemCollection object that contains the root items of the current RadMenu control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadMenuItemCollection Items { get; }
A RadMenuItemCollection that contains the root items of the current RadMenu control. By default the collection is empty (RadMenu has no children).
Implements:
Use the Items property to access the root items of the RadMenu control. You can also use the Items property to manage the root items - you can add, remove or modify items.
Gets or sets the template for displaying the items in RadMenu.
[TemplateContainer(typeof(RadMenuItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public ITemplate ItemTemplate { get; set; }
An object which implements the ITemplate interface. The default value is a null reference (Nothing in Visual Basic), which indicates that this property is not set.
The ItemTemplate property sets a template that will be used for all menu items.
To specify unique display for individual items use the ItemTemplate property of the RadMenuItem class.
Gets or sets the template displayed when child items are being loaded.
[TemplateContainer(typeof(RadMenuItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public ITemplate LoadingStatusTemplate { get; set; }
Gets or sets the maximum number of levels to bind to the RadMenu control.
public override int MaxDataBindDepth { get; set; }
The maximum number of levels to bind to the RadMenu control. The default is -1, which binds all the levels in the data source to the control.
Overrides:
When binding the RadMenu control to a data source, use the MaxDataBindDepth property to limit the number of levels to bind to the control. For example, setting this property to 2 binds only the root menu items and their immediate children. All remaining records in the data source are ignored.
Gets or sets a value indicating the client-side event handler that is called after an item loses focus.
[ClientControlEvent]
[ClientPropertyName("itemBlur")]
public string OnClientItemBlur { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemBlur client-side event handler is called when a menu item loses focus as a result of the user pressing a key or clicking elsewhere on the page. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called after a menu item is clicked.
[ClientControlEvent]
[ClientPropertyName("itemClicked")]
public virtual string OnClientItemClicked { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
This event is similar to OnClientItemFocus but fires only on mouse click.
If specified, the OnClientItemClicked client-side event handler is called after a menu item is clicked upon. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when a menu item is clicked.
[ClientControlEvent]
[ClientPropertyName("itemClicking")]
public virtual string OnClientItemClicking { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
This event is similar to OnClientItemFocus but fires only on mouse click.
If specified, the OnClientItemClicking client-side event handler is called before a menu item is clicked upon. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with three properties, get_item() (the instance of the menu item), get_cancel()/set_cancel() - indicating if the event should be cancelled and get_domEvent (a reference to the browser event).
The OnClientItemClicking event can be cancelled. To do so, return False from the event handler.
Gets or sets a value indicating the client-side event handler that is called when a group of child items closes.
[ClientControlEvent]
[ClientPropertyName("itemClosed")]
public string OnClientItemClosed { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemClosed client-side event handler is called when a group of child items closes. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when a group of child items is closing.
[ClientControlEvent]
[ClientPropertyName("itemClosing")]
public string OnClientItemClosing { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemClosing client-side event handler is called when a group of child items closes. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with three properties, get_item() (the instance of the menu item), get_cancel()/set_cancel() - indicating if the event should be cancelled and get_domEvent (a reference to the browser event).
This event can be cancelled.
Gets or sets a value indicating the client-side event handler that is called when a menu item gets focus.
[ClientControlEvent]
[ClientPropertyName("itemFocus")]
public string OnClientItemFocus { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemFocus client-side event handler is called when a menu item is selected using either the keyboard (the [TAB] or arrow keys) or by clicking it. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when a group of child items opens.
[ClientControlEvent]
[ClientPropertyName("itemOpened")]
public string OnClientItemOpened { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Gets or sets a value indicating the client-side event handler that is called when a group of child items begin to open.
[ClientControlEvent]
[ClientPropertyName("itemOpening")]
public string OnClientItemOpening { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Gets or sets a value indicating the client-side event handler that is called when a menu item children were just populated (for example from web service).
[ClientControlEvent]
[ClientPropertyName("itemPopulated")]
public string OnClientItemPopulated { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemPopulated client-side event handler is called when a menu item children were just populated. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with one property:
- get_item(), the instance of the menu item.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when a menu item children are about to be populated (for example from web service).
[ClientControlEvent]
[ClientPropertyName("itemPopulating")]
public string OnClientItemPopulating { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemPopulating client-side event handler is called when a menu item children are about to be populated. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with three properties:
- get_item(), the instance of the menu item.
- get_context(), an user object that will be passed to the web service.
- set_cancel(), used to cancel the event.
This event can be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the operation for populating the children of a menu item has failed.
[ClientControlEvent]
[ClientPropertyName("itemPopulationFailed")]
public string OnClientItemPopulationFailed { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemPopulationFailed client-side event handler is called when the operation to populate the children of a menu item has failed. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties:
- get_item(), the instance of the menu item.
- set_cancel(), set to true to suppress the default action (alert message).
This event can be cancelled.
Gets or sets a value indicating the client-side event handler that is called after the RadMenu client-side object is initialized.
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClienLoad client-side event handler is called after the menu is fully initialized on the client.
A single parameter - the menu client object - is passed to the handler.
This event cannot be cancelled.
Gets or sets the OnClientMenuPopulated- the javascript function called before the children of a menu item are populated.
[ClientControlEvent]
[ClientPropertyName("menuPopulated")]
public string OnClientMenuPopulated { get; set; }
The OnClientMenuPopulated.
Gets or sets the on OnClientMenuPopulating javascript function called before the children of a menu item are populated..
[ClientControlEvent]
[ClientPropertyName("menuPopulating")]
public string OnClientMenuPopulating { get; set; }
The OnClientMenuPopulating.
Gets or sets a value indicating the client-side event handler that is called when the mouse moves out of a menu item in the RadMenu 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.
If specified, the OnClientMouseOut client-side event handler is called when the mouse moves out of a menu item. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the mouse moves over a menu item in the RadMenu 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.
If specified, the OnClientMouseOver client-side event handler is called when the mouse moves over a menu item. Two parameters are passed to the handler:
- sender, the menu client object;
- eventArgs with two properties, get_item() (the instance of the menu item) and get_domEvent (a reference to the browser event).
This event cannot be cancelled.
Gets or sets the name of the JavaScript function called when the client template for an item is evaluated
[ClientControlEvent]
[ClientPropertyName("templateDataBound")]
public string OnClientTemplateDataBound { get; set; }
When set to true, the items populated through Load On Demand are persisted on the server.
[ClientControlProperty]
[ClientPropertyName("persistLoadOnDemandItems")]
public bool PersistLoadOnDemandItems { get; set; }
Gets or sets the URL of the page to post to from the current page when a menu item is clicked.
public override string PostBackUrl { get; set; }
The URL of the Web page to post to from the current page when a menu item is clicked. The default value is an empty string (""), which causes the page to post back to itself.
Overrides:
Gets a RadMenuItem object that represents the selected item in the RadMenu control.
[Browsable(false)]
public RadMenuItem SelectedItem { get; }
The user can select a item by clicking on it. Use the SelectedItem property to determine which node is selected in the RadMenu control.
An item cannot be selected when it's configured to navigate to a given location.
Gets or sets a value indicating whether a toggle button is rendered when an item has children..
[ClientControlProperty]
[ClientPropertyName("showToggleHandle")]
public bool ShowToggleHandle { get; set; }
By default RadMenu will not render toggle button for the item with children.
protected override bool SupportsRenderingMode { get; }
Overrides:
Gets the settings for the web service used to populate items ExpandMode set to WebService.
[PersistenceMode(PersistenceMode.InnerProperty)]
public NavigationControlWebServiceSettings WebServiceSettings { get; }
An WebServiceSettings that represents the web service used for populating items.
Use the WebServiceSettings property to configure the web service used to populate items on demand. You must specify both Path and Method to fully describe the service.
You can use the LoadingStatusTemplate property to create a loading template.
In order to use the integrated support, the web service should have the following signature:
<pre><code class="lang-csharp">[ScriptService]public class WebServiceName : WebService { [WebMethod] public RadMenuItemData[] WebServiceMethodName(RadMenuItemData item, object context) { // We cannot use a dictionary as a parameter, because it is only supported by script services. // The context object should be cast to a dictionary at runtime. IDictionary<string, object> contextDictionary = (IDictionary<string, object>) context;
//... }}
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
This methods clears the selected item of the current RadMenu instance. Useful when you need to clear item selection after postback.
public void ClearSelectedItem()
protected override ControlItemCollection CreateChildItemCollection()
Overrides:
protected override NavigationItemBindingCollection CreateDataBindings()
Overrides:
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
Returns the first RadMenuItem that matches the conditions defined by the specified predicate. The predicate should returns a boolean value.
public RadMenuItem FindItem(Predicate<RadMenuItem> match)
The Predicate <> that defines the conditions of the element to search for.
Returns:Searches the RadMenu control for the first RadMenuItem with a Text property equal to the specified value.
public RadMenuItem 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 RadMenuItem whose Text property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenu control for the first RadMenuItem with a Text property equal to the specified value.
public RadMenuItem FindItemByText(string text)
The value to search for.
Returns:A RadMenuItem whose Text property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenu control for the first RadMenuItem with a NavigateUrl property equal to the specified value.
public RadMenuItem FindItemByUrl(string url)
The value to search for.
Returns:A RadMenuItem whose NavigateUrl property is equal to the specified value.
The method returns the first Item matching the search criteria. If no Item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenu control for the first RadMenuItem with a Value property equal to the specified value.
public RadMenuItem 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 RadMenuItem whose Value property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenu control for the first RadMenuItem with a Value property equal to the specified value.
public RadMenuItem FindItemByValue(string value)
The value to search for.
Returns:A RadMenuItem whose Value property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Gets a linear list of all items in the RadMenu control.
public IList<RadMenuItem> GetAllItems()
An IList<RadMenuItem> containing all items (from all hierarchy levels).
Use the GetAllItems method to obtain a linear collection of all items regardless their place in the hierarchy.
Populates the RadMenu control from external XML file.
public override void LoadContentFile(string xmlFileName)
The name of the XML file.
Overrides:
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 override void LoadXml(ControlItemContainer deserialized)
Overrides:
protected override void RaiseItemDataBound(ControlItem item)
Overrides:
protected void RaiseMenuItemEvent(object eventKey, RadMenuEventArgs e)
protected override void RaiseTemplateNeeded(ControlItem item)
Overrides:
protected override void ReadXmlForChildren(XmlReader reader)
Overrides:
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
protected override void WriteXmlForChildren(XmlWriter writer)
Overrides:
Events
Occurs on the server when a menu item in the RadMenu control is clicked.
public virtual event RadMenuEventHandler ItemClick
The menu will also postback if you navigate to a menu item using the [menu item] key and then press [enter] on the menu item that is focused. The instance of the clicked menu item is passed to the MenuItemClick event handler - you can obtain a reference to it using the eventArgs.RadMenuItem property.
Occurs on the server when an item in the RadMenu control is created.
public event RadMenuEventHandler ItemCreated
The ItemCreated event is raised every time a new item is added.
The ItemCreated event is not related to data binding and you cannot retrieve the DataItem of the item in the event handler.
The ItemCreated event is often useful in scenarios where you want to initialize all items - for example setting the ToolTip of each RadMenuItem to be equal to the Text property.
Occurs after a menu item is data bound.
public event RadMenuEventHandler ItemDataBound
The ItemDataBound event is raised for each menu item upon databinding. You can retrieve the item being bound using the event arguments. The DataItem associated with the item can be retrieved using the DataItem property.
The ItemDataBound event is often used in scenarios when you want to perform additional mapping of fields from the DataItem to their respective properties in the RadMenuItem class.
Occurs before template is being applied to the menu item.
public event RadMenuEventHandler TemplateNeeded
The TemplateNeeded event is raised before a template is been applied on the menu item, both during round-trips (postbacks) and at the time data is bound to the control. The TemplateNeeded event is not raised for menu items which are defined inline in the page or user control.
The TemplateNeeded event is commonly used for dynamic templating.