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, ...Adding in a CSS (possibly dynamically determined) from a control?Adding in a CSS (possibly dynamically determined) from a control?
Previous
 
Next
New Post
2/20/2008 3:22 PM
 

Afternoon all,

I've been working on my proof of concept for the cluster of pages I'm building, and I've now successfully managed to get my data retrieved from the stored procs in the pre-existing database, and displayed via manually building a table. 

So, now I need to integrate CSS into this.  Once I've got that working, I think the boss will be happy (or at least a tad lest touchy about the progress or perceived lack thereof)

Now, right now, I'm going to be pointing it to a single CSS file, which I will know the location of.  In the future, I'll be wanting to point to different CSS files, depending on the path\URL of the page the user is at.

My concern is, that according to what I've read regarding CSS, and mind you, I've worked with it like one time, about 5 years ago, on a single page, the linkage or internal css stuff has to be loaded in the page header, although inline stuff obvious goes wherever...

So, my question is, how do I get the CSS info into the page from the module?  Since it's going to be dynamically determined, I can't use any of the functionality I've seen in other skins or containers to hard code the values...

Thoughts?

Thanks,
Brian

 
New Post
2/20/2008 5:32 PM
 

Firstly, CSS doesn't necessarily need to go in the header, though it's best if it does.  You can access the header by casting the page to DotNetNuke.Framework.CDefault and accessing the Header control.  It could look something like this (in C#)

((DotNetNuke.Framework.CDefault)this.Page).Header.Controls.Add(new LiteralControl(@"<link type=""text/css"" href=""" + GetCssUrl() + """/>"));

Or, you can just link dynamically to the CSS in the body of your control.  Something like this:

<style type="text/css">
@import url(<%=GetCssUrl() %>)
</style>

 

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Adding in a CSS (possibly dynamically determined) from a control?Adding in a CSS (possibly dynamically determined) from a control?


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