How to clear all Page Level skins in DotNetNuke

How to clear all Page Level skins in DotNetNuke

If you have a DotNetNuke website that has been around for a while, you likely have a large number of pages on the site. Many of those pages likely have individual Skins (themes) applied to them, we will call those Page Level skins. When there is a skin defined at the Page Level in DNN, that setting overrides the skin that is defined at the Website Level, meaning, if you change the skin at the Website level, it would not change the look and feel of any of the pages with their own skins defined.

This is actually a very common scenario, and you might not want to use the contents of this blog post to change your site. If you do want to remove Page Level skins, continue reading.

Often times when you are going to be updating your website to a new design you want to change the skin on every page of your website, the problem being that for the pages with Page level skins defined, you have to hit each and every page manually in the page settings.

To make this process easier, I’ve written some sample SQL scripts that you can use to clear all page level Skins from a portal. I have also included a script that will do the same for Containers which can be defined at the Page and at the Module level.

In order to execute these scripts you need to use the HOST/SQL page, or you can replace {databaseOwner} with your databaseowner setting from your web.config file (the default is just “dbo.” without the quotes). You also should replace the {objectQualifier} setting from your web.config, (by default that is blank “”). You will also need to replace 0 with the proper PortalID (if you have 1 portal in DNN it is 0, the next is 1, 2, etc)

As with all sample code and sql scripts, I am not responsible for any damage you cause to your or your client’s sites. Always test in a controlled environment before attempting to use in production.

Clear all page level skins in a Portal


update {databaseOwner}{objectQualifier}Tabs
set skinsrc=null
where SkinSrc is not null
and PortalID=0

Clear all page level containers in a Portal


update {databaseOwner}{objectQualifier}tabs
set containersrc=null
where containersrc is not null
and PortalID=0

Clear all module level containers in a Portal


update {databaseOwner}{objectQualifier}TabModules 
set ContainerSrc = null
where TabModuleID in (select TabModuleId 
    from {databaseOwner}{objectQualifier}TabModules tm
    join {databaseOwner}{objectQualifier}Modules m 
            on (tm.ModuleID = m.ModuleID)
    where ContainerSrc is not null
    and m.PortalId=0)

Recent Comments

Comment Avatar
Testing out a new comment form on the website here. If you see this comment, it worked!
Posted By: Chris Hammond on Jan 2013
Comment Avatar
That is what we always applied our websites when they are redesigned by new skins updates. However , we will upadtes all the pages because there seem to be some special pages with static skins or containers. And to advoid any possible demage, we will execute select script to confirm the return result before executing updates. Thanks a lot for sharing.
Posted By: Baldwin Sun on Apr 2013
Comment Avatar
Saved me a load of work. I had issues with a corrupted Catalyst skin and this cleared them. I still have an issue with no uninstall icon appearing next to the Catalyst Red skin. Also, not next to their containers. So how do I get rid of these?
Posted By: Michael Durthaler on Mar 2014
Comment Avatar
Michael, I always just delete the skin/containers from the file system if I can't get them removed elsewhere, That should remove them from the Selection options.
Posted By: Chris Hammond on Mar 2014
Comment Avatar
This post was exactly what I needed! I was trying to clean up all the old "unused" skins and containers, but didn't realize all the places where references were buried in the database. Thanks so much for taking time to write this!
Posted By: C F on Mar 2016
Comment Avatar

Sorry I see this is old. I am trying to clean out old skins/containers and this would be great. In my web.config I have objectQualifier="" databaseOwner="dbo" So I try this: update {dbo}{""}Tabs set skinsrc=null where SkinSrc is not null and PortalID=2 and get this error Incorrect syntax near '}'. An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name. update {dbo}{""}Tabs set skinsrc=null where SkinSrc is not null and PortalID=2 What exactly should I run? Sorry I am not SQLiterate. thanks, Will

Posted By: Will Sugg on Jul 2016
Comment Avatar
Will, simply remove the curly braces {} they aren't needed, neither would ""
Posted By: Chris Hammond on Jul 2016
Comment Avatar
Got it to work when I got the syntax right dbo.tabs This saved the day! thanks
Posted By: Will Sugg on Jul 2016
Comment Avatar

Thanks Chris - trying to Clear all module level containers in a Portal and still getting an error. Can you please tell me exactly what i need to run? I am on DNN 8. Here is the error: Incorrect syntax near '}'. Incorrect syntax near '}'. update {dbo}TabModules set ContainerSrc = null where TabModuleID in (select TabModuleId from {dbo}TabModules tm join {dbo}Modules m on (tm.ModuleID = m.ModuleID) where ContainerSrc is not null and m.PortalId=2)

Posted By: Will Sugg on Jul 2016
Comment Avatar
I've run your scripts on a DNN 7 install to remove page/container/module level settings to an old skin. I don't see any errors and I do see a message saying query ran successfully. On a couple of pages where there are page level settings, the skin settings were not removed. Any idea why? Thanks very much.
Posted By: Dulci Nea on Mar 2020
Comment Avatar
Dulci that sounds like perhaps you need to clear the cache and restart IIS?
Posted By: Chris Hammond on Mar 2020
Comment Avatar

Chris, thanks for your quick reply. I was just coming in here to let you know that I had reset cache in browser and also through DNN. All good now. thanks for taking the time to write back.

Posted By: Dulci Nea on Mar 2020

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type DNNRocks in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.