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

Choose a binding strategy:

Templates: a node picks the first available in priority: its own NodeTemplate then the control-level NodeTemplate then (optionally) ClientNodeTemplate for client rendering.

ContentTemplate vs child nodes: a ContentTemplate cannot coexist with child nodes; an attempt leads to a NavigationNodeTemplateException.

Performance tips: limit depth via MaxDataBindDepth for large hierarchies; defer heavy template logic to client where suitable.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("Navigation", typeof(RadNavigation))]
[EmbeddedSkin("Navigation", "Default", typeof(RadNavigation))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadNavigation))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[RequiredScript(typeof(jQueryPlugins), 1)]
[RequiredScript(typeof(DropDown), 2)]
[RequiredScript(typeof(MaterialRipple))]
[ClientScriptResource("Telerik.Web.UI.RadNavigation", "Telerik.Web.UI.Navigation.RadNavigationScripts.js")]
[ToolboxBitmap(typeof(RadNavigation), "Toolbox.Icons.Navigation.png")]
[TelerikToolboxCategory("Navigation")]
public class RadNavigation : RadDataBoundControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, INavigationNodeContainer

Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlRadNavigation...

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupINavigationNodeContainerIParserAccessorIPostBackDataHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members DataBoundControl.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.LoadViewState(object)DataBoundControl.SaveViewState()DataBoundControl.TrackViewState()DataBoundControl.DataMemberDataBoundControl.IsUsingModelBindersDataBoundControl.ItemTypeDataBoundControl.SelectMethodDataBoundControl.DataSourceIDDataBoundControl.DataSourceObjectDataBoundControl.SelectArgumentsDataBoundControl.CreatingModelDataSourceDataBoundControl.CallingDataMethodsBaseDataBoundControl.ConfirmInitState()BaseDataBoundControl.EnsureDataBound()BaseDataBoundControl.OnDataBound(EventArgs)BaseDataBoundControl.DataSourceBaseDataBoundControl.InitializedBaseDataBoundControl.IsBoundUsingDataSourceIDBaseDataBoundControl.IsDataBindingAutomaticBaseDataBoundControl.SupportsDisabledAttributeBaseDataBoundControl.RequiresDataBindingBaseDataBoundControl.DataBoundWebControl.AddAttributesToRender(HtmlTextWriter)WebControl.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 RadNavigation()

Properties

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

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

Supplies an inline client-side template (Kendo templating syntax) applied to each node after data binding on the client.

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

Executed in the browser; use when you need dynamic HTML without server round trips.

Has access to fields declared via DataKeyNames or normal node properties (e.g. #= Text #).

Does not override server templates (NodeTemplate) already rendered.

Example:
C#
RadNavigation1.ClientNodeTemplate = "<span class="icon #= SpriteCssClass #"></span><span class="title">#= Text #</span>";

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

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

An AnimationSettings that represents the collapse animation.

Use the CollapseAnimation property to customize the expand animation of RadNavigation. You can specify the Type and Duration. To disable collapse animation effects you should set the Type to AnimationType.None.
To customize the expand animation you can use the ExpandAnimation property.

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

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

C#
protected override string CssClassFormatString { get; }

Overrides: RadDataBoundControl.CssClassFormatString

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

Gets or sets the data field holding the unique identifier for a NavigationNode.

C#
public virtual string DataFieldID { get; set; }
Property Value:

The data field ID.

Gets or sets the data field holding the ID of the parent NavigationNode.

C#
public virtual string DataFieldParentID { get; set; }
Property Value:

The data field parent ID.

Gets or sets an array of data-field names that will be used to populate the NavigationNode 's DataItem property which is used to populated the control's template.

C#
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(ListConverter))]
[PersistenceMode(PersistenceMode.Attribute)]
public virtual string[] DataKeyNames { get; set; }
Property Value:

An array that contains the names of the fields contained in the RadNavigation's DataItem property.

Note: The dataItem's properties declared in the template should be with lower case .

Gets or sets the data field holding the Navigation URL property for the currently bound NavigationNode.

C#
public virtual string DataNavigateUrlField { get; set; }
Property Value:

The data navigate URL field.

Gets or sets the data field holding the Text property for the currently bound NavigationNode.

C#
public virtual string DataTextField { get; set; }
Property Value:

The data text field.

Gets or sets a value indicating how the NavigationNode's text should be formatted.

C#
public virtual string DataTextFormatString { get; set; }

When set to true enables support for WAI-ARIA.

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

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 RadNavigation 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 the settings for the animation played when the dropdown opens.

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

An AnimationSettings that represents the expand animation.

Use the ExpandAnimation property to customize the expand animation of RadNavigation. You can specify the Type and Duration. 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)
{
RadNavigation1.ExpandAnimation.Type = AnimationType.Linear;
RadNavigation1.ExpandAnimation.Duration = 300;
}

Gets or sets the image position.

C#
public RadNavigationImagePostion ImagePosition { get; set; }
Property Value:

The image position.

Used to customize the Navigation keyboard navigation functionality.

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

Limits how many hierarchical levels are bound when data contains nested children (-1 binds all).

C#
public virtual int MaxDataBindDepth { get; set; }

Use to prevent excessively deep trees from rendering for large data sets.

Set to 0 to bind only root nodes; 1 for root + direct children, etc.

Works with both hierarchical and self-referencing binding (see DataFieldID, DataFieldParentID).

Example:
C#
RadNavigation1.MaxDataBindDepth = 2; // root + level1 + level2

Gets or sets the menuButton position.

C#
public RadNavigationMenuButtonPostion MenuButtonPosition { get; set; }
Property Value:

The menuButton position.

Gets the Nodes.

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

The Nodes.

Implements: INavigationNodeContainer.Nodes

Gets or sets template for all Nodes that doesn't have template nor does their Node.

C#
[TemplateContainer(typeof(NavigationNode))]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public ITemplate NodeTemplate { get; set; }
Property Value:

The Node template.

Gets or sets the on client load.

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

The on client load.

Gets or sets the on NavigationNode clicked.

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

The on NavigationNode clicked.

Gets or sets the on NavigationNode clicking.

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

The on NavigationNode clicking.

Gets or sets the on client Node collapsed.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("nodeCollapsed")]
public string OnClientNodeCollapsed { get; set; }
Property Value:

The on client Node collapsed.

Gets or sets the on client Node collapsing.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("nodeCollapsing")]
public string OnClientNodeCollapsing { get; set; }
Property Value:

The on client Node collapsing.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("nodeExpanded")]
public string OnClientNodeExpanded { get; set; }

Gets or sets the on client Node expanding.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("nodeExpanding")]
public string OnClientNodeExpanding { get; set; }
Property Value:

The on client Node expanding.

Gets or sets the name of the JavaScript function called when the mouse enters a node

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

Gets or sets the name of the JavaScript function called when the mouse leaves a node

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

Gets or sets the on NavigationNodes populated.

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

The on NavigationNodes populated.

Gets or sets the on NavigationNodes populating.

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

The on NavigationNodes populating.

Gets or sets the name of the JavaScript function called when the client template for a node is evaluated

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

Gets the resolved render mode.

C#
public override RenderMode ResolvedRenderMode { get; }
Property Value:

The resolved render mode.

Overrides: RadDataBoundControl.ResolvedRenderMode

C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadDataBoundControl.SupportsRenderingMode

C#
protected override HtmlTextWriterTag TagKey { get; }

Overrides: WebControl.TagKey

Methods

Binds a data source to the invoked server control and all its child controls.

C#
public override void DataBind()

Overrides: BaseDataBoundControl.DataBind()

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

Overrides: RadDataBoundControl.DescribeComponent(IScriptDescriptor)

Finds the Node by text.

C#
public NavigationNode FindNodeByText(string text)
Parameters:textstring

The text.

Returns:

NavigationNode

Finds the Node by URL.

C#
public NavigationNode FindNodeByUrl(string url)
Parameters:urlstring

The URL.

Returns:

NavigationNode

Gets a linear list of all Nodes in the NavigationNode.

C#
public IList<NavigationNode> GetAllNodes()
Returns:

IList<NavigationNode>

An IList<T> containing all Nodes (from all hierarchy levels).

C#
protected override IDataSource GetDataSource()
Returns:

IDataSource

Overrides: DataBoundControl.GetDataSource()

C#
protected override void OnInit(EventArgs e)
Parameters:eEventArgs

Overrides: RadDataBoundControl.OnInit(EventArgs)

C#
protected override void OnPreRender(EventArgs e)
Parameters:eEventArgs

Overrides: RadDataBoundControl.OnPreRender(EventArgs)

C#
protected override void PerformDataBinding(IEnumerable data)
Parameters:dataIEnumerable

Overrides: DataBoundControl.PerformDataBinding(IEnumerable)

C#
protected void RaiseTemplateNeeded(NavigationNode node)
Parameters:nodeNavigationNode
C#
protected override void RenderContents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDataBoundControl.RenderContents(HtmlTextWriter)

C#
protected void RenderNodes(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter
C#
protected void RenderRootElements(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Events

Occurs when NavigationNode is bound

C#
public event NavigationNodeEventHandler NodeDataBound

Occurs before template is being applied to the Node.

C#
public event NavigationNodeEventHandler TemplateNeeded

The TemplateNeeded event is raised before a template is been applied on the Node, both during round-trips (postbacks) and at the time data is bound to the control. The TemplateNeeded event is not raised for Nodes 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 RadNavigation1_TemplateNeeded(object sender, Telerik.Web.UI.NavigationNodeEventArguments e)
{
string value = e.Node.Value;
if (value != null)
{
// if the value is an even number
if ((Int32.Parse(value) % 2) == 0)
{
var textBoxTemplate = new TextBoxTemplate();
e.Node.NodeTemplate = textBoxTemplate;
}
}
}