Give an unique id for every DNN Containers

Inspired by Think of Design’s avoid span in module title and amount of requests including myself to have a unique id for every containers in DotNetNuke, I’ve came out with this simple solution to ease the designing works in DotNetNuke Skinning.

<!-- From -->
<%@ Control language="vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Containers.Container" %>
 <%@ Register TagPrefix="dnn" TagName="TITLE" Src="~/Admin/Containers/Title.ascx" %>
 <%@ Register TagPrefix="dnn" TagName="Actions" Src="~/Admin/Containers/Actions.ascx" %>
 <dnn:title runat="server" id="dnnTitle" visible="false" />
 <% Dim ModuleTitle As String = GetPortalModuleBase(dnnTitle).ModuleConfiguration.ModuleTitle %>
 <div class="common">
 <h3><%= ModuleTitle %></h3>
 <dnn:Actions runat="server" id="dnnActions" />
 <div id="ContentPane" runat="server" />

Using the same logic, we can retrieve the module id by modifying the DNN property code:

<% Dim ConModule As DotNetNuke.Entities.Modules.ModuleInfo = DotNetNuke.UI.Containers.Container.GetPortalModuleBase(Me).ModuleConfiguration %>
<div id="Container<%=ConModule.ModuleID %>" class="PekoOutterCon con180">

Theoretically, all you need to do is to change the .ModuleTitle to .ModuleID. Since CSS id cannot start with a number, you will need to add some word before calling out the ModuleID in the div.

However, you will find that if you logout from DNN, the module will failed to call out the correct ModuleID.

Thus, you will have to define that correct container and ModuleInfo.

Now you can change the individual container without interfering with other DNN Container.