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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedApply different style/css to different instance of the same moduleApply different style/css to different instance of the same module
Previous
 
Next
New Post
1/6/2012 7:11 PM
 

Hi everyone,

I'm trying to figure out how to show the same module in different visual ways. I know the module.css is loaded automatically and applies to any instance of the module, as all the elements, classes are the same within any instance... which actually makes modules look similar.

What I want is to show multiple instances of the same module, and apply different CSS styles to each instance, say instance1 of the module should use module1.css, instance2 should be using module2.css, etc...

Any experience?

 
New Post
1/7/2012 4:31 PM
 
theres no way to do this by default - typically if you want to apply a different look per module instance you would do this by changing the container. However I guess you could do this via a similar technique to http://www.thinkofdesign.com/blog/83/hook-your-dotnetnuke-skins (except for modules rather than pages)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/11/2012 6:53 AM
 

That's exactly what I've been looking for.

Never thought of such CSS tricks - with minor addons works perfect!

Thanks Cathal!

 
New Post
1/11/2012 1:29 PM
 
Glad to hear it works - if you've a chance please blog about it, I'm sure others would be interested.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/13/2012 9:26 PM
 

Yeah, to make things clear, my objective was to be able to show the same module different ways:

  1. general layout was to show listview items in usual over-under order,
  2. specific layout, where listview items would appear in side-by-side manner.

There are other criteria to show/hide like showing dates and categories, as well as number of items to show. All are managed by module's TabSettings.

So what I did was:

ASCX:

<asp:ListView ID="LV_Main" runat="server">
    <ItemTemplate>
        <div id="EntryWrapper" runat="server" class="divEntryWrapper">
            ...
        </div>
    </ItemTemplate>
    <LayoutTemplate>
        <div ID="itemPlaceholderContainer" runat="server">
            <span runat="server" id="itemPlaceholder" />
        </div>
    </LayoutTemplate>

Code Behind:

Protected Sub LV_Main_LayoutCreated(sender As Object, e As System.EventArgs) Handles LV_Main.LayoutCreated

    Dim itemPlaceholderContainer As HtmlControl = DirectCast(sender.FindControl("itemPlaceholderContainer"), HtmlControl)
    itemPlaceholderContainer.Attributes.Add("class", "GeBlogPage" & TabId.ToString)

End Sub

I've put the logic into the code-behind as putting it directly into the ASCX didn't work for some reason.

module.css

/* General Layout */
.divEntryWrapper
{
    border-style: solid;
    border-width: 1px;
    -moz-border-radius: 7px;
    border-radius: 7px;
    margin-bottom: 2em;
}

/*Page specific layout */
.GeBlogPage55 .divEntryWrapper
{
    border-style: solid; 
    border-width: 1px;
    display: inline-block;
    width: 19.5%;
    text-align:center;
    word-wrap: break-word;
}

The example above for page specific layout assumes the TabId=55.

Hope this helps!

 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedApply different style/css to different instance of the same moduleApply different style/css to different instance of the same module


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