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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Styling Module Content - best practicesStyling Module Content - best practices
Previous
 
Next
New Post
6/9/2008 6:17 AM
 

I've written a simple module using LINQ to SQL with a couple of LinqDataSources that contains a DropDownList and a gridview control.

I'd like some advice about the best way to style this.

In standard ASP.NET I could use Themes or stylesheets, and make use of properties like CssClass or SkinID. I'd obvously prefer to separate the business logic from the design, so would definitely need to use CSS stylesheets like all good websites and avoid built-in control styles.

But, in DNN I'd also be aiming to use the powerful skinning technology built into the DNN architecture. I've played around with this a bit and am aware that this also makes use of CSS stylesheets.

It would be nice if the DNN skin I install with its CSS stylesheets would also style the internal contents of my module, but will it? Or will I need to provide additional stylesheets with the module installation? If so, how will the module-specific styles interact with the styles in the DNN skin installed separately?

Looking at existing modules (e.g. Blog 03.04.00) in my DNN 04.08.02 installation, I notice that there is a DesktopModules\Blog\module.css stylesheet present. But looking at the UserControls in Blog - e.g. Blog.ascx, I also see that some controls refer to styles not present in the local module.css stylesheet - e.g. CssClass="CommandButton". After some scouting around I found this in Portals\_default\default.css

Is there a document that describes how these different stylesheets interact with one another, what their heirarchy and purpose is and which takes precedence over which others, and the rules about which styles should be defined where?

And in particular, how these rules relate to best practices when making allowances for styling modules one is developing oneself. What should I do as a module developer to insure that other people's skins can reach inside my module and style its contents, if possible?

Many thanks,

Steve Taylor

 

 
New Post
6/10/2008 11:38 AM
 

If memory serves, your best bet for information on how the css files interact is found in the skinning PDF found in the Documentation download for each version.  It's been my experiance that the css classes used in skins and containers does not cover anything beyond the basics.  I was able to find styles for a Tree type control in the File Manager class but I've never really found much that would apply to a grid.  So I end up creating my own stylesheet.  It would be nice if the core (aka protal.css) included some classes targeted for various types of standard controls like trees and grids.  That way skin developers could taylor those classes to match their skins and containers.  I don't know if they could do anything useful and still be generic enought to support the abundant amount of tree and grid controls out there but it would be nice if they could.

 
New Post
6/10/2008 11:51 AM
 

Hi Steve,

Sounds like you're on the right track.  As you noticed, default.css supports a lot of basic elements, and hooking into these classes will allow your module to automatically adopt the portal's look and feel.  So, whenever possible, use these as a base.  This means liberal use of the Normal, NormalBold, CommandButton classes for text, the DataGrid_* classes for grids, and TreeMenu_* classes for trees.

For your needs beyond these classes, you have a couple routes.  As in the blog module, you could just include a custom stylesheet in the module directory.  But what about portal-specific customizations?  If this is a requirement, you'll need to consider additional stylesheets in the portal-specific directories.

I typically serve a base stylesheet embedded within the assembly, and then allow for portal-specific overrides.  DNN has a hook to check for the existence of such a stylesheet and only include a reference if the file exists, which increases the page response time.

Finally, remember that ASP.NET allows for the specification of multiple classes in its controls.  Make liberal use of this -- instead of CssClass="Normal" or CssClass="MyModuleNormal", use CssClass="Normal MyModuleNormal", and then MyModuleNormal can just modify the Normal class as appropriate.

I'm sure other people handle these issues differently, but this is my current approach.  I'd be interested in seeing how others handle these sorts of situations

Hope this gets you started!

Brandon


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Styling Module Content - best practicesStyling Module Content - best practices


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