HomeHomeUsing DotNetNuk...Using DotNetNuk...Skins, Themes, ...Skins, Themes, ...Add class to DnnModule outer divAdd class to DnnModule outer div
Previous
 
Next
New Post
6/20/2012 2:12 PM
 

Is there any way to add a custom class to the outer div that contains the "DnnModule" class that is created when a module is placed on a page via the container?  Currently, if I make a container that is to be floated left with a specific width, there is no way to utilize that layout unless I use javascript to go in to the HTML and add my float properties to the DnnModule level div.

For example, if I'm using a scaffolding system (bootstrap) and want to add several containers of different sizes (span3, span6, span12) when I add a module to the content pane with those containers, it's ignored due to the outer div that DNN adds around each module. This is extremely limiting from a CSS layout perspective and it forces the skin developer to create many individually styled skins rather than a couple skins with multiple containers to allow for more flexibility.  

 
New Post
6/21/2012 3:55 PM
 

By default you cannot add a class to that wrapper div.
In general, we float panes and put container in there that are not floated.
There might be a way using server side code, but I never tried (and I already tried a lot ;-)


Web applications, DNN websites, modules, skins and support
 
New Post
6/21/2012 4:05 PM
 

Ok, I tried again and found a way, but I didn not tes tit on DNN 6:

In an ascx container, inject this on top just below the @register declarations:

<script runat="server">
    
    Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
        
        Try
            Dim cParent As HtmlGenericControl = CType(Me.Parent, HtmlGenericControl)
            cParent.Attributes("class") = cParent.Attributes("class") + " FloatLeft"
        Catch ex As Exception
            
        End Try

    End Sub

</script>

HTH


Web applications, DNN websites, modules, skins and support
 
New Post
6/21/2012 5:14 PM
 

C# version:

<script runat="server">    
protected void Page_PreRender(object sender, EventArgs e) {
try {
HtmlGenericControl cParent = (HtmlGenericControl) this.Parent;
cParent.Attributes["class"] += " span9";
} catch (Exception ex) { 
// do nothing 
}
}
</script>

 
New Post
11/28/2012 10:57 AM
 
I tried this in DNN 6, and it does not work for me. Someone who has tried it and succeeded?
 
Previous
 
Next
HomeHomeUsing DotNetNuk...Using DotNetNuk...Skins, Themes, ...Skins, Themes, ...Add class to DnnModule outer divAdd class to DnnModule outer div


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.