26 August 2009

DNN no container span causes validation error

If you turn off the DNN container for a module, then DNN by default inserts an extra SPAN that can cause a W3C validation error. One solution is to have a minimal container.

I had turned off the "Display Container" option for some modules so that no title is displayed. (In Admin Edit mode, the default container is used so that you can get at settings etc.) The HTML produced by DNN looked like this, within the skin pane:
<a name="402"></a>/
<span id="dnn_ctr402_ContentPane" class="DNNAlignleft">
<!-- Start_Module_402 -->
<div id="dnn_ctr402_ModuleContent">

and then the module content.

This causes a validation error because you cannot nest a DIV within a SPAN.

My solution is not to use the "Display Container" option - instead, I created a container with no title and used that instead. In the replacement container, I moved the [ACTIONS] and [ICON] into the footer. This NoTitleContainer container files are available here: http://www.phdcc.com/download/DNN/NoTitleContainer.zip. Unzip in /Portals/_default/Containers/MinimalExtropy. I'm not sure if you need to go to [Admin][Skins] to make the container visible.


Unknown said...

Hi Chris,

Thanks for the Post confirming a problem I'm facing.

I want to use the Inventua SideMenu on a page but I don't want the default Container (No Container.ascx ) which has no style with a left padding to offset the Menu items built.

So, I now need to figure out how to create the very simple NoContainer.ascx in my own Custom Container ... Wish you had posted your Container.zip

Cheers, Paul in LA, CA USA

Chris Cant said...

I've added in a link to a zip of the extra files that I've added. Note that this is not a proper container file. Chris

Unknown said...

Hi Chris,

Thanks for the ascx and html.
I figured out how to install the ascx.

To Install in DNN4 or DNN5

Put the NoTitleContainer.ascx into Containers.zip and that into NoTitleContainer.zip


Admin > Skins - Upload Skin


Host > Modules – Install Module

DNN will complain there is no .dnn Manifest file and ask you if this is a SKIN or Container or Module

specify Container

follow instructions and you should see the NoTitleContainer as a choice in the Container dropdownlist.

Thanks, Paul

mike schepker said...


Can you post instructions (or an updated file) on how to change your no title container with the actions and icon in the top left instead of in the footer? We don't want the title in the container but prefer our actions to be at the top.

Any help would be greatly appreciated!


Chris Cant said...

Here's what I think you want:


Put in /Portals/_default/Containers/MinimalExtropy and Parse Skin Package in [Admin][Skins]

I made this by copying Title_Blue.htm and chopping out the h2 tag with class c_title.

Anonymous said...

Hi Chris

Is this DNN version specific by any chance?

I'll have another play tomorrow (using DNN 4.9.5) but even after extracting the original linked file to my Containers folder (not called MinimalExtropy ... but I assume I just needed to load it into my actual Container folder) I am still getting validation errors at the same point, though slightly different.

I haven't re-loaded the source code into Visual Studio yet so I'm light on details, but just thought I'd find out first if your NoTitleContainer.ascx was written with a specific DNN version in mind

Thanks, Adrian

Chris Cant said...

I am pretty certain that it works in both DNN4 and DNN5. It contains pretty simple DIVs.

Adrian said...

Yeah, I thought I might be clutching at straws there

Should I be setting the pages to display the container AND apply the containers.zip? I'm still seeing the span tags with div tags inside them (with display container title turned off on the individual pages), even though I have applied the NoTitleContainer.ascx both ways described (yours and Paul in LA)

I might have to live with displaying the titles, it's better than not being able to Validate properly

Thanks, Adrian

Adrian said...

OK, sorted!

I didn't realise that I did indeed have to set the pages to Display Container Titles, as well as apply your container

Great, now I get best of both worlds (no container titles, and XHTML validation)

Thanks again