Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

CustomAttributes

Return to previous page

  • 4/7/2015
  • 2455 Views

Comments

2455 Views

CustomAttributes

Last updated long time ago

Comments

Common

(Enter the content of this article below)

Advanced

 
DotNetNuke has supported navigation providers since 2005. The provider model is based off of interfaces, promoting a one-size-fits-all mentality. This can be both a blessing and a curse. The curse as it relates to the navigation providers is that it limits the features that the navigation provider's control can support.

For example, if a menu wanted a mechanism to support horizontal submenus, the provider model would have to be changed which expose it to all providers, which of course makes little sense for something like a treeview With the released of DotNetNuke 4.5 the ability to specify custom attributes to the navigation providers was added. This can be accomplished by adding the following to the skin's ascx file.

The following directive needs to be added at the top

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.UI.Skins" Assembly="DotNetNuke" %>


Then within your skin object you simply embed a CustomAttributes element, then specify one or more attributes.

<dnn:NAV ID="dnnNav" runat="server" ProviderName="DNNMenuNavigationProvider">
<CustomAttributes>
<dnn:CustomAttribute Name="SubMenuOrientation" Value="Horizontal"/>
</CustomAttributes>
</dnn:NAV>

How it works

This is accomplished by adding a Generics collection to the NavObjectBase (which is used by the Nav.ascx skin object).


<DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerProperty)> _
Public ReadOnly Property CustomAttributes() As Generic.List(Of CustomAttribute)
Get
Return m_objCustomAttributes
End Get
End Property

The provider will then be able to enumerate these custom attributes and apply them to the underlying control.

For Each objAttr As DotNetNuke.UI.Skins.CustomAttribute In Me.CustomAttributes
Select Case objAttr.Name.ToLower
Case "submenuorientation"
Me.Menu.SubMenuOrientation = DirectCast(System.Enum.Parse(Me.Menu.SubMenuOrientation.GetType, objAttr.Value), DotNetNuke.UI.WebControls.Orientation)

End Select
Next

Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out