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, ...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 ;-)

 
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

 
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 DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Add class to DnnModule outer divAdd class to DnnModule outer div


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