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

RadMenu

Class

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:

C#
[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: RadContextMenu

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlItemContainerIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIRadMenuItemContainerIScriptControlISkinnableControlIUrlResolutionServiceIXmlSerializable...

Inherited Members HierarchicalControlItemContainer.LoadViewState(object)HierarchicalControlItemContainer.SaveViewState()HierarchicalControlItemContainer.TrackViewState()HierarchicalControlItemContainer.GetDataSource()HierarchicalControlItemContainer.PerformDataBinding(IEnumerable)HierarchicalControlItemContainer.FindChildByUrl<TControlItem>(string)HierarchicalControlItemContainer.FindItemByHierarchicalIndex(string)HierarchicalControlItemContainer.DataNavigateUrlFieldHierarchicalControlItemContainer.DataFieldIDHierarchicalControlItemContainer.DataFieldParentIDControlItemContainer.PrepareForDataBinding()ControlItemContainer.GetXml()ControlItemContainer.LoadXml(string)ControlItemContainer.CreateItem(ClientStateLogEntry)ControlItemContainer.FindChild<TControlItem>(Predicate<TControlItem>)ControlItemContainer.GetAllChildren<TControlItem>()ControlItemContainer.FindChildByValue<TControlItem>(string)ControlItemContainer.FindChildByValue<TControlItem>(string, bool)ControlItemContainer.FindChildByText<TControlItem>(string)ControlItemContainer.FindChildByText<TControlItem>(string, bool)ControlItemContainer.FindChildByAttribute<TControlItem>(string, string)ControlItemContainer.ReadXml(XmlReader)ControlItemContainer.GetItemTypeFromXmlTagName(string)ControlItemContainer.WriteXml(XmlWriter)ControlItemContainer.GetXml(XmlSerializer, TextWriter)ControlItemContainer.GetPostbackEventReference()ControlItemContainer.AppendDataBoundItemsControlItemContainer.DataTextFieldControlItemContainer.DataValueFieldControlItemContainer.DataTextFormatStringControlItemContainer.ValidationGroupControlItemContainer.CausesValidationControlItemContainer.KeyboardNavigationSettingsControlItemContainer.TemplateControlItemContainer.ChildrenControlItemContainer.TagKeyDataBoundControl.OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)DataBoundControl.CreateDataSourceSelectArguments()DataBoundControl.GetData()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.CssClassWebControl.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 RadMenu()

Properties

Gets the object that controls the Wai-Aria settings applied on the control's input element.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WaiAriaSettings AriaSettings { get; }

The minimum available height that is needed to enable the auto-scroll.

C#
[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.

C#
[ClientControlProperty]
[ClientPropertyName("autoScrollMinimumWidth")]
public int AutoScrollMinimumWidth { get; set; }
Property Value:

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.

C#
[ClientControlProperty]
[ClientPropertyName("_childListElementCssClass")]
protected string ChildListElementCssClass { get; set; }

Gets or sets a value indicating whether root items should open on mouse click.

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

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.

C#
[Browsable(false)]
public IList<ClientOperation<RadMenuItem>> 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;RadMenuItem&gt; operation in RadToolBar1.ClientChanges)
{
RadMenuItem 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 menu.
break;
case ClientOperationType.Update:
UpdateClientOperation&lt;RadMenuItem&gt; update = operation as UpdateClientOperation&lt;RadMenuItem&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 or sets the template for displaying the items in RadMenu.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public virtual string ClientItemTemplate { get; set; }

Gets the settings for the animation played when an item 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 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.

Example:
cs-api-definition

Gets or sets a value indicating the timeout after which a menu item starts to close.

C#
[ClientControlProperty]
[ClientPropertyName("collapseDelay")]
public int CollapseDelay { get; set; }
Property Value:

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.

Example:
C#
<p>The following example demonstrates how to specify one second (1000
milliseconds) timeout prior to item closing:</p>
<p>ASPX:</p>
<p>&lt;telerik:RadMenu ID="RadMenu1" runat="server"
<strong>ClosingDelay="1000"</strong> /&gt;</p>

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 a collection of RadMenuItemBinding objects that define the relationship between a data item and the menu item it is binding to.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public RadMenuItemBindingCollection DataBindings { get; }
Property Value:

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.

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

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.

C#
[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.

C#
[ClientControlProperty]
[ClientPropertyName("enableAutoScroll")]
public bool EnableAutoScroll { get; set; }

Gets or sets a value indicating whether items images should be preloaded.

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

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.

C#
[ClientControlProperty]
[ClientPropertyName("enableImageSprites")]
public virtual 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 if an overlay should be rendered (only in Internet Explorer).

C#
[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.

C#
[ClientControlProperty]
[ClientPropertyName("enableRootItemScroll")]
public bool EnableRootItemScroll { get; set; }

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 the screen boundary detection will be applied when menu items are expanded.

C#
[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.

C#
[ClientControlProperty]
[ClientPropertyName("enableSelection")]
public virtual bool EnableSelection { get; set; }

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 or sets a value indicating whether the html encoding will be applied when the menu items are rendered.

C#
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.

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 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.

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

Gets or sets a value indicating the timeout after which a menu item starts to open.

C#
[ClientControlProperty]
[ClientPropertyName("expandDelay")]
public int ExpandDelay { get; set; }
Property Value:

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.

Example:
C#
<p>The following example demonstrates how to specify a half second (500
milliseconds) timeout prior to item opening:</p>
<p>ASPX:</p>
<p>&lt;telerik:RadMenu ID="RadMenu1" runat="server"
<strong>ExpandDelay="500"</strong> /&gt;</p>

Gets or sets a value indicating the way top level items will flow.

C#
[ClientControlProperty]
[ClientPropertyName("_flow")]
public virtual ItemFlow Flow { get; set; }
Property Value:

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.

Example:
C#
<p>The following example demonstrates how to make a vertical menu.</p>
<p>ASPX:</p>
<p>&lt;telerik:RadMenu ID="RadMenu1" runat="server"
<strong>Flow="Vertical"</strong> /&gt;</p>

Gets a RadMenuItemCollection object that contains the root items of the current RadMenu control.

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

A RadMenuItemCollection that contains the root items of the current RadMenu control. By default the collection is empty (RadMenu has no children).

Implements: IRadMenuItemContainer.Items

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.

Example:
cs-api-definition
RadMenu1.Items[0].Text = "Example";
RadMenu1.Items[0].NavigateUrl = "http://www.example.com";

Gets or sets the template for displaying the items in RadMenu.

C#
[TemplateContainer(typeof(RadMenuItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public ITemplate ItemTemplate { get; set; }
Property Value:

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.

Example:
C#
<p>The following example demonstrates how to use the
<strong>ItemTemplate</strong> property to add a CheckBox for each item.</p>
<p>ASPX:</p>
<p>&lt;telerik:RadMenu runat="server" ID="RadMenu1"&gt;</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
    <p>&lt;ItemTemplate&gt;</p>
    <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
        <p>&lt;asp:CheckBox runat="server"
        ID="CheckBox"&gt;&lt;/asp:CheckBox&gt;<br />
        &lt;asp:Label runat="server" ID="Label1"</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
            <p>Text='&lt;%# DataBinder.Eval(Container, "Text") %&gt;'</p>
            <p>&gt;&lt;/asp:Label&gt;</p>
        </blockquote>
    </blockquote>
    <p>&lt;/ItemTemplate&gt;</p>
    <p>&lt;Items&gt;</p>
    <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
        <p>&lt;telerik:RadMenuItem Text="News" /&gt;</p>
        <p>&lt;telerik:RadMenuItem Text="Sports" /&gt;</p>
        <p>&lt;telerik:RadMenuItem Text="Games" /&gt;</p>
    </blockquote>
    <p>&lt;/Items&gt;</p>
</blockquote>
<p>&lt;/telerik:RadMenu&gt;</p>

Gets or sets the template displayed when child items are being loaded.

C#
[TemplateContainer(typeof(RadMenuItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public ITemplate LoadingStatusTemplate { get; set; }
Example:
C#
The following example demonstrates how to use the LoadingStatusTemplate to display an image.

<p>
&lt;telerik:RadMenu runat="server" ID="RadMenu1"&gt;
    &lt;LoadingStatusTemplate&gt;
        &lt;asp:Image runat="server" ID="Image1" ImageUrl="~/Img/loading.gif" /&gt;
    &lt;/LoadingStatusTemplate&gt;
&lt;/telerik:RadMenu&gt;
</p>

Gets or sets the maximum number of levels to bind to the RadMenu control.

C#
public override int MaxDataBindDepth { get; set; }
Property Value:

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: HierarchicalControlItemContainer.MaxDataBindDepth

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.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
 function onClientItemBlurHandler(sender, eventArgs)<br />
 {<br />
 alert(eventArgs.get_item().get_text());<br />
 }<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
 runat="server"<br />
    <strong>OnClientItemBlur="onClientItemBlurHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called after a menu item is clicked.

C#
[ClientControlEvent]
[ClientPropertyName("itemClicked")]
public virtual string OnClientItemClicked { get; set; }
Property Value:

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.

Example:
C#
&lt;script type="text/javascript"&gt;<br />
function onClientItemClickedHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;<br />
&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemClicked="onClientItemClickedHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;

Gets or sets a value indicating the client-side event handler that is called when a menu item is clicked.

C#
[ClientControlEvent]
[ClientPropertyName("itemClicking")]
public virtual string OnClientItemClicking { get; set; }
Property Value:

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemClickingHandler(sender, eventArgs)<br />
{<br />
if (eventArgs.get_item().get_text() == "News")<br />
{</p>
<p>return false;</p>
<p>}<br />
}<br />
&lt;/script&gt;<br />
&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemClicking="onClientItemClickingHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when a group of child items closes.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemClosedHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemClose="onClientItemClosedHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when a group of child items is closing.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemClosingHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemClose="onClientItemClosingHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when a menu item gets focus.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemFocusHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemFocus="onClientItemFocusHandler"&gt;</strong><br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when a group of child items opens.

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

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

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemOpenedHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemOpen="onClientItemOpenedHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when a group of child items begin to open.

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

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

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemOpeningHandler(sender, eventArgs)<br />
{<br />
alert(eventArgs.get_item().get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemOpening="onClientItemOpeningHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

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).

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemPopulatedHandler(sender, eventArgs)<br />
{<br />
       var item = eventArgs.get_item();<br />
       alert("Loading finished for " + item.get_text());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemPopulated="onClientItemPopulatedHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

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).

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemPopulatingHandler(sender, eventArgs)<br />
{<br />
       var item = eventArgs.get_item();<br />
       var context = eventArgs.get_context();<br />
       context["CategoryID"] = item.get_value();<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemPopulating="onClientItemPopulatingHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

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.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientItemPopulationFailedHandler(sender, eventArgs)<br />
{<br />
       var item = eventArgs.get_item();<br />
       var errorMessage = eventArgs.get_errorMessage();<br />
       <br />
       alert("Error: " + errorMessage);<br />
       eventArgs.set_cancel(true);<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat="server"<br />
    <strong>OnClientItemPopulationFailed="onClientItemPopulationFailedHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets a value indicating the client-side event handler that is called after the RadMenu client-side object is initialized.

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

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientLoadHandler(sender)<br />
{<br />
       alert(sender.get_id());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
runat= "server"<br />
    <strong>OnClientLoad="onClientLoadHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

Gets or sets the OnClientMenuPopulated- the javascript function called before the children of a menu item are populated.

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

The OnClientMenuPopulated.

Gets or sets the on OnClientMenuPopulating javascript function called before the children of a menu item are populated..

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

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.

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.

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.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
 function onClientMouseOutHandler(sender, eventArgs)<br />
 {<br />
 alert(eventArgs.get_item().get_text());<br />
 }<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadMenu ID="RadMenu1"<br />
 runat= "server"<br />
    <strong>OnClientMouseOut="onClientMouseOutHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadMenu&gt;</p>

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.

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.

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.

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

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function onClientMouseOverHandler(sender, eventArgs)<br />
         {<br />
         alert(eventArgs.get_item().get_text());<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;telerik:RadMenu ID="RadMenu1"<br />
         runat= "server"<br />
        <strong>OnClientMouseOver="onClientMouseOverHandler"</strong>&gt;<br />
        ....<br />
        &lt;/telerik:RadMenu&gt;
    </div>
</p>

Gets or sets the name of the JavaScript function called when the client template for an item is evaluated

C#
[ClientControlEvent]
[ClientPropertyName("templateDataBound")]
public string OnClientTemplateDataBound { get; set; }

When set to true, the items populated through Load On Demand are persisted on the server.

C#
[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.

C#
public override string PostBackUrl { get; set; }
Property Value:

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: ControlItemContainer.PostBackUrl

Gets a RadMenuItem object that represents the selected item in the RadMenu control.

C#
[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 the Value of the selected item.

C#
[Browsable(false)]
[ClientControlProperty]
[ClientPropertyName("_selectedValue")]
public string SelectedValue { get; }
Property Value:

The Value of the selected item. If there is no selected item returns empty string.

Gets or sets a value indicating whether a toggle button is rendered when an item has children..

C#
[ClientControlProperty]
[ClientPropertyName("showToggleHandle")]
public bool ShowToggleHandle { get; set; }

By default RadMenu will not render toggle button for the item with children.

C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadDataBoundControl.SupportsRenderingMode

Gets the settings for the web service used to populate items ExpandMode set to WebService.

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

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

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

Overrides: RadDataBoundControl.AddAttributesToRender(HtmlTextWriter)

This methods clears the selected item of the current RadMenu instance. Useful when you need to clear item selection after postback.

C#
public void ClearSelectedItem()
C#
protected override ControlItemCollection CreateChildItemCollection()
Returns:

ControlItemCollection

Overrides: ControlItemContainer.CreateChildItemCollection()

C#
protected override IRenderer CreateControlRenderer()
Returns:

IRenderer

Overrides: RadDataBoundControl.CreateControlRenderer()

C#
protected override NavigationItemBindingCollection CreateDataBindings()
Returns:

NavigationItemBindingCollection

Overrides: HierarchicalControlItemContainer.CreateDataBindings()

C#
protected override ControlItem CreateItem()
Returns:

ControlItem

Overrides: ControlItemContainer.CreateItem()

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

Overrides: ControlItemContainer.DescribeComponent(IScriptDescriptor)

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

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

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

Returns:

RadMenuItem

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadMenu1.FindItem(ItemWithEqualsTextAndValue);
}
private static bool ItemWithEqualsTextAndValue(RadMenuItem item)
{
if (item.Text == item.Value)
{
return true;
}
else
{
return false;
}
}

Searches the RadMenu control for the first RadMenuItem with a Text property equal to the specified value.

C#
public RadMenuItem 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:

RadMenuItem

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.

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

The value to search for.

Returns:

RadMenuItem

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.

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

The value to search for.

Returns:

RadMenuItem

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.

C#
public RadMenuItem 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:

RadMenuItem

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.

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

The value to search for.

Returns:

RadMenuItem

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.

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

IList<RadMenuItem>

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.

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
foreach (RadMenuItem item in RadMenu1.GetAllItems())
{
item.Enabled = false;
}
}
C#
protected override void InitializeItem(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.InitializeItem(ControlItem)

Populates the RadMenu control from external XML file.

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

The name of the XML file.

Overrides: HierarchicalControlItemContainer.LoadContentFile(string)

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)
{
RadMenu1.LoadContentFile("~/Menu/Examples/Menu.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 override void LoadXml(ControlItemContainer deserialized)
Parameters:deserializedControlItemContainer

Overrides: ControlItemContainer.LoadXml(ControlItemContainer)

C#
protected virtual void OnItemClick(RadMenuEventArgs e)
Parameters:eRadMenuEventArgs
C#
protected virtual void OnItemCreated(RadMenuEventArgs e)
Parameters:eRadMenuEventArgs
C#
protected virtual void OnItemDataBound(RadMenuEventArgs e)
Parameters:eRadMenuEventArgs
C#
protected virtual void OnTemplateNeeded(RadMenuEventArgs e)
Parameters:eRadMenuEventArgs
C#
protected virtual void RaiseItemClick(ControlItem item)
Parameters:itemControlItem
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 void RaiseMenuItemEvent(object eventKey, RadMenuEventArgs e)
Parameters:eventKeyobjecteRadMenuEventArgs
C#
protected virtual void RaisePostBackEvent(string nodeIndex)
Parameters:nodeIndexstring
C#
protected override void RaiseTemplateNeeded(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseTemplateNeeded(ControlItem)

C#
protected override void ReadXmlForChildren(XmlReader reader)
Parameters:readerXmlReader

Overrides: ControlItemContainer.ReadXmlForChildren(XmlReader)

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

Overrides: RadDataBoundControl.RenderContents(HtmlTextWriter)

C#
protected override void WriteXmlForChildren(XmlWriter writer)
Parameters:writerXmlWriter

Overrides: ControlItemContainer.WriteXmlForChildren(XmlWriter)

Events

Occurs on the server when a menu item in the RadMenu control is clicked.

C#
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.

C#
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.

Example:
cs-api-definition
private void RadMenu1_ItemCreated(object sender, Telerik.WebControls.RadMenuItemEventArgs e)
{
e.Item.ToolTip = e.Item.Text;
}

Occurs after a menu item is data bound.

C#
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.

Example:
cs-api-definition
private void RadMenu1_ItemDataBound(object sender, Telerik.WebControls.RadMenuEventArgs e)
{
RadMenuItem item = e.RadMenuItem;
DataRowView dataRow = (DataRowView) e.Item.DataItem;

item.ImageUrl = "image" + dataRow["ID"].ToString() + ".gif";
item.NavigateUrl = dataRow["URL"].ToString();
}

Occurs before template is being applied to the menu item.

C#
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.

Example:
cs-api-definition
protected void RadMenu1_TemplateNeeded(object sender, Telerik.Web.UI.RadMenuEventArgs 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
DefinitionConstructorsRadMenu()PropertiesAriaSettingsAutoScrollMinimumHeightAutoScrollMinimumWidthChildListElementCssClassClickToOpenClientChangesClientItemTemplateCollapseAnimationCollapseDelayCssClassFormatStringDataBindingsDefaultGroupSettingsEnableAriaSupportEnableAutoScrollEnableImagePreloadingEnableImageSpritesEnableOverlayEnableRootItemScrollEnableRoundedCornersEnableScreenBoundaryDetectionEnableSelectionEnableShadowsEnableTextHTMLEncodingExpandAnimationExpandDelayFlowItemsItemTemplateLoadingStatusTemplateMaxDataBindDepthOnClientItemBlurOnClientItemClickedOnClientItemClickingOnClientItemClosedOnClientItemClosingOnClientItemFocusOnClientItemOpenedOnClientItemOpeningOnClientItemPopulatedOnClientItemPopulatingOnClientItemPopulationFailedOnClientLoadOnClientMenuPopulatedOnClientMenuPopulatingOnClientMouseOutOnClientMouseOverOnClientTemplateDataBoundPersistLoadOnDemandItemsPostBackUrlSelectedItemSelectedValueShowToggleHandleSupportsRenderingModeWebServiceSettingsMethodsAddAttributesToRender(HtmlTextWriter)ClearSelectedItem()CreateChildItemCollection()CreateControlRenderer()CreateDataBindings()CreateItem()DescribeComponent(IScriptDescriptor)FindItem(Predicate<RadMenuItem>)FindItemByText(string, bool)FindItemByText(string)FindItemByUrl(string)FindItemByValue(string, bool)FindItemByValue(string)GetAllItems()InitializeItem(ControlItem)LoadContentFile(string)LoadPostData(string, NameValueCollection)LoadXml(ControlItemContainer)OnItemClick(RadMenuEventArgs)OnItemCreated(RadMenuEventArgs)OnItemDataBound(RadMenuEventArgs)OnTemplateNeeded(RadMenuEventArgs)RaiseItemClick(ControlItem)RaiseItemCreated(ControlItem)RaiseItemDataBound(ControlItem)RaiseMenuItemEvent(object, RadMenuEventArgs)RaisePostBackEvent(string)RaiseTemplateNeeded(ControlItem)ReadXmlForChildren(XmlReader)RenderContents(HtmlTextWriter)WriteXmlForChildren(XmlWriter)EventsItemClickItemCreatedItemDataBoundTemplateNeeded
Not finding the help you need?
Contact Support