Dnn / @Dnn Object in Dynamic Code ☢️ (Dnn only)
The Dnn
is a helper object which contains properties to access information about the current tab, portal, user, module etc.
Discover More in the Razor Tutorials
We have an rich series of Razor tutorials. You should really check them out 👍.
How to use
Here's a quick example of using the Dnn
object in a Razor template:
<!-- show the current users nice name -->
@Dnn.User.DisplayName
How it works
There's not much to explain here, we're just providing the standard Dnn objects to the template.
The Main Properties of the @Dnn Object
These are the main properties:
- Module
- Portal
- Tab
- User
The @Dnn.Module Properties
The @Dnn.Module
is of the type ModuleInfo. It has the following properties:
- Dnn.Module.AllModules
- Dnn.Module.AllTabs
- Dnn.Module.Border
- Dnn.Module.Cacheability
- Dnn.Module.CacheMethod
- Dnn.Module.CacheTime
- Dnn.Module.ContainerPath
- Dnn.Module.ContainerSrc
- Dnn.Module.DefaultCacheTime
- Dnn.Module.DesktopModule
- Dnn.Module.DesktopModuleId
- Dnn.Module.DisplayTitle
- Dnn.Module.EndDate - for show/hide
- Dnn.Module.Footer
- Dnn.Module.Header
- Dnn.Module.ModuleControl
- Dnn.Module.ModuleControlId
- Dnn.Module.ModuleDefID - note: large D
- Dnn.Module.ModuleDefinition
- Dnn.Module.ModuleID - probably the most used value, note the large ID
- Dnn.Module.ModuleName
- Dnn.Module.ModuleOrder
- Dnn.Module.ModulePermissions
- Dnn.Module.ModuleSettings
- Dnn.Module.ModuleTitle
- Dnn.Module.PaneModuleCount
- Dnn.Module.PaneModuleIndex
- Dnn.Module.PaneName
- Dnn.Module.ParentTab - a TabInfo, same as Dnn.Tab
- Dnn.Module.PortalID - note large D
- Dnn.Module.StartDate - for show/hide rules
- Dnn.Module.TabID - note large D
- Dnn.Module.TabModuleID - note large D
- Dnn.Module.TabModuleSettings
- Dnn.Module.UniqueId
- Dnn.Module.Visibility
The @Dnn.Portal Properties
The @Dnn.Portal
is of the type PortalSettings. It has the following properties:
- Dnn.Portal.ActiveTab
- Dnn.Portal.AdministratorId
- Dnn.Portal.AdministratorRoleId
- Dnn.Portal.AdministratoRoleName
- Dnn.Portal.AdminTabId
- Dnn.Portal.CultureCode
- Dnn.Portal.Currency
- Dnn.Portal.Current - static method returning the current portal portal-settings
- Dnn.Portal.Default... (AdminContainer, AdminSkin, ControlPanelMode, etc.)
- Dnn.Portal.DefaultLanguage
- Dnn.Portal.DefaultModuleId
- Dnn.Portal.DefaultPortalContainer
- Dnn.Portal.DefaultTabId
- Dnn.Portal.Description
- Dnn.Portal.Email
- Dnn.Portal.EnableBrowserLanguage
- Dnn.Portal.EnableUrlLanguage
- Dnn.Portal.ExpiryDate
- Dnn.Portal.FooterText
- Dnn.Portal.GetProperty(string, string, cultureInfo, UserInfo, scope, boolean) - ?
- Dnn.Portal.GUID - notice all large letters
- Dnn.Portal.HomeDirectory
- Dnn.Portal.HomeDirectoryMapPath
- Dnn.Portal.HomeTabId - the root page
- Dnn.Portal.KeyWords
- Dnn.Portal.LoginTabId - where the normal login usually goes to
- Dnn.Portal.LogoFile
- Dnn.Portal.Pages
- Dnn.Portal.PortalAlias
- Dnn.Portal.PortalId - very important - notice the small d
- Dnn.Portal.PortalName
- Dnn.Portal.PortalSkin
- Dnn.Portal.RegisteredRoleId
- Dnn.Portal.RegisteredRoleName
- Dnn.Portal.RegisterTabId
- Dnn.Portal.Search... (various values like IncludeCommon, IncludeTagInfoFilter etc.)
- Dnn.Portal.SearchTabId
- Dnn.Portal.SiteLogHistory
- Dnn.Portal.SplashTabId
- Dnn.Portal.SSLEnabled
- Dnn.Portal.SSLEnforced
- Dnn.Portal.SSLURL - all caps
- Dnn.Portal.STDURL - all caps
- Dnn.Portal.SuperTabId
- Dnn.Portal.TimeZoneOffset
- Dnn.Portal.UserId
- Dnn.Portal.UserInfo
- Dnn.Portal.UserMode
- Dnn.Portal.UserQuota
- Dnn.Portal.UserRegistration
- Dnn.Portal.Users
- Dnn.Portal.UserTabId
The @Dnn.Tab Properties
The @Dnn.Tab
is of the type TabInfo. It has the following properties:
- Dnn.Tab.ChildModules
- Dnn.Tab.ContainerPath
- Dnn.Tab.ContainerSrc
- Dnn.Tab.CultureCode
- Dnn.Tab.DefaultLanguageGuid
- Dnn.Tab.DefaultLanguageTab
- Dnn.Tab.Description
- Dnn.Tab.EndDate - for show/hide of this tab
- Dnn.Tab.FullUrl
- Dnn.Tab.HasChildren
- Dnn.Tab.IsDefaultLanguage
- Dnn.Tab.IsDeleted
- Dnn.Tab.IsNeutralCulture
- Dnn.Tab.IsSecure
- Dnn.Tab.IsTranslated
- Dnn.Tab.IsVisible
- Dnn.Tab.KeyWords
- Dnn.Tab.Level
- Dnn.Tab.LocalizedTabName
- Dnn.Tab.LocalizedTabs
- Dnn.Tab.Modules
- Dnn.Tab.PageHeadtext
- Dnn.Tab.Panes
- Dnn.Tab.ParentId
- Dnn.Tab.PermanentRedirect
- Dnn.Tab.PortalID - notice the large D
- Dnn.Tab.RefreshInterval
- Dnn.Tab.SiteMapPriority
- Dnn.Tab.SkinDoctype
- Dnn.Tab.SkinPath
- Dnn.Tab.SkinSrc
- Dnn.Tab.StartDate - for show/hide
- Dnn.Tab.TabID - the current Tab-number - notice the large D
- Dnn.Tab.TabName
- Dnn.Tab.TabOrder
- Dnn.Tab.TabPath
- Dnn.Tab.TabPermissions
- Dnn.Tab.TabSettings
- Dnn.Tab.TabType
- Dnn.Tab.Title
- Dnn.Tab.UniqueId - small "d"
- Dnn.Tab.Url
The @Dnn.User Properties
The @Dnn.User
is of the type UserInfo. It has the following properties:
- Dnn.User.DisplayName
- Dnn.User.Email
- Dnn.User.FirstName
- Dnn.User.FullName
- Dnn.User.IsDeleted
- Dnn.User.IsInRole(string RoleName)
- Dnn.User.IsSuperUser
- Dnn.User.LastName
- Dnn.User.Membership - these are asp.net memberships, you probably don't need them
- Dnn.User.PortalId
- Dnn.User.Roles - these are Dnn roles
- Dnn.User.UserID - note the large D
- Dnn.User.Username
History
- Introduced in 2sxc 1.0