Saturday, July 10, 2010

DotNetNuke: Common tips for skin Developers

    Skin Development

  1. How to add reference to jQuery?
    Add following server tag at the top of your skin file
    Add following at the end of your skin file:

    <%  DotNetNuke.Framework.jQuery.RequestRegistration()%> 
    <script runat="server">
     Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
     End Sub
    Thanks to Brian Dukes for correcting this
  2. How to access Tab Name?

    <%=  PortalSettings.ActiveTab.TabName%> 
    Now that you know how PortalSettigns is having ActiveTab you can play with properties of ActiveTab which is of type TabInfo
  3. How to access currently logged in user?

    <%=  PortalSettings.UserInfo.DisplayName%> 
    Once again PortalSettigns, you can use PortalSettings.UserInfo.Roles to provide role based elements to your skin.
  4. how to get path of Skin folder?
    Most useful and easy one

    <%=  SkinPath%> 
    so if you want to show an tips.jpg which is images directory in your skin root directory, do this

    <img src="<%=SkinPath %>images/tips.jpg" alt="tips" title="tips" />
  5. How to find default portal and admin skins from database?

    selecT* from PortalSettings where SettingName in ('DefaultAdminContainer','DefaultAdminSkin','DefaultPortalContainer','DefaultPortalSkin')
    select * from HostSettings where SettingName in ('DefaultAdminContainer','DefaultAdminSkin','DefaultPortalContainer','DefaultPortalSkin')
    DNN will try to look at PortalSettings table and see if admin and default portal skins are available there, if found, it will apply that settings otherwise it will load it from HostSettings table.
    Here is more advanced link from dnn blog.

    Reference and links for skin development

  1. There are lots of skin objects, which are described well here, or you can download entire DotNetNuke Skinning Guide from dotnetnuke website.
  2. Building dnn skins using BluePrint css framework
    Free Sample skin developed using BluePrint css framework
  3. Tutorial on building DNN Skins using YAML
  4. Pros and cons of using css frameworks in dnn


Please drop me a line to get any kind help regarding the dnn skin development and administration problems.


  1. The call to jQuery.RequestRegistration needs to happen before the PreRender, so it actually can't just be put in <% %> tags. It needs to run from the Init or Load event in the skin, i.e.

    <script runat="server">
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init


    End Sub

  2. Thanks for correcting me.
    I will update the post


Please add your valuable comments about this post if it helped you. Thanks