Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Programmatically loading a skinProgrammatically loading a skin
Previous
 
Next
New Post
2/12/2009 9:57 AM
 

I've been searching the forums here for a way to programmatially assign a skin and really think I've got it figured out, but I'm getting some buggyness and error messages that make me think it's not just right yet. Can anyone shed some light on this?

Here is the skin file I've selected for the portal. Very simple at this point:

<%@ Control Language="VB" ClassName="DynamicSkin" Inherits="DotNetNuke.UI.Skins.Skin" %>
<asp:PlaceHolder ID="SkinHolder" runat="server" />
<script runat="server">
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
        SkinHolder.Controls.Add(LoadControl("skin1.ascx"))
    End Sub
</script>
 

Here is the "skin1.ascx" that this file references:

<%@ Control Language="VB" ClassName="Skin1" Inherits="DotNetNuke.UI.Skins.Skin" %>
<div id="ControlPanel" runat="server" />
<div id="TopPane" runat="server" />
<div id="ContentPane" runat="server" />
<div id="BottomPane" runat="server" />
 

As you can see, I hope, I am trying to have the first file (dynamicskin.ascx) load and apply skin1.ascx (same folder) to the page. It appears to be working correctly except for these things:

1. I have two control panel div's. Even though there is not one specified in dynamicskin.ascx, it's still appearing there. However, if I remove that line from skin1.ascx, the page errors out with "Object reference not set to an instance of an object" on the line of code that adds the skin as a control.

2. At the bottom of my page, I have errors that appear to be one for each module on the page. In host mode, they say "DotNetNuke.Services.Exceptions.ModuleLoadException: Cannot locate ContentPane for Skin." In logged-out mode, they say "Unhandled error loading module"... Yet I can still place controls in "TopPane", "ContentPane", and "BottomPane" and they seem to work correctly.

Am I missing something obvious?

FYI... I've tried moving the Page_Init Code to Page_Load - same result. I read something about a Page_PreInit event but I don't see that event as an option.

This is very similar to the resolution discussed here, which I believe is what I have implemented.

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Programmatically loading a skinProgrammatically loading a skin


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out