Dynamically setting skin in DNN 3.x

Last post 04-10-2006 3:57 PM by BriC. 3 replies.

Sort Posts:

  • Dynamically setting skin in DNN 3.x

    03-22-2005, 10:48 AM
    • Member
      155 point Member
    • VoidX1
    • Member since 07-31-2004, 2:05 PM
    • Posts 31
    Hi,

    In some old post I saw that you can set your skin with this and it works in DNN 2.x:

    Dim CSSFile As String = "/Portals/styles/test/skin.css"
    Dim litCSS As Literal = New Literal
    litCSS.Text = "<LINK href= " & CSSFile & " type=text/css rel=stylesheet>"
    Dim objCSS As System.Web.UI.Control = Page.FindControl("CSS")
    objCSS.Controls.Add(litCSS)


    But in 3.x it fails, I tried setting CSSFile to different paths but it wouldnt load the skin.css.
    So does it still work or do I have to change the code?
  • Re: Dynamically setting skin in DNN 3.x

    04-05-2006, 5:18 PM
    • Member
      153 point Member
    • BriC
    • Member since 04-19-2004, 1:05 PM
    • Vancouver (White Rock) BC
    • Posts 34
    Did you eventually find a solution to this?  I'm in the same boat (trying to dynamically load a skin).
  • Re: Dynamically setting skin in DNN 3.x

    04-10-2006, 3:15 AM
    • Participant
      1,010 point Participant
    • Vladan Strigo
    • Member since 01-19-2003, 12:07 PM
    • Split, Croatia
    • Posts 218

    You can do the following:

    Dim cssHolder As Control = CType(Me.Page, DotNetNuke.Framework.CDefault).FindControl("CSS")

    If Not (cssHolder Is Nothing) Then
       Dim cssLink As New HtmlGenericControl("LINK")
       With cssLink
             .ID = "SOME_ID_NAME" & CStr(Me.ModuleId)
             .Attributes("rel") = "stylesheet"
             .Attributes("type") = "text/css"
             .Attributes("href") = Me.ResolveUrl(SOME_CSS_PATH)
       End With
       cssHolder.Controls.Add(cssLink)
    End if

    that should work just fine,

     

    Thanks, Vladan Strigo

    My website: Vladan.Strigo.NET
  • Re: Dynamically setting skin in DNN 3.x

    04-10-2006, 3:57 PM
    • Member
      153 point Member
    • BriC
    • Member since 04-19-2004, 1:05 PM
    • Vancouver (White Rock) BC
    • Posts 34
    Thanks much.  I'll tell how the process went once I find time to sit down to do it (busy with paying projects at the moment).

    :)
Page 1 of 1 (4 items)