andyb1979
 Nuke Pro Posts:62
 |
| 23 Feb 2008 6:09 PM |
|
Does anyone know if you can access the SkinPath tag in a container ascx file? I keep getting exceptions when I do this. It says:
"CS0103: The name 'SkinPath' does not exist in the current context"
What im trying to do is inject a conditional stylesheet for IE6 for my containers. I found a post somewhere on the web saying I can add this to my ascx file:
<script type="text/javascript">
if (document.createStyleSheet) document.createStyleSheet("<%=SkinPath%>/containerIE6.css"); </script>
However when I add it to a container I get the above exception.
Does anyone know a way to inject custom stylesheets for containers to view them in IE6?
Thanks!
AndyB
|
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
jncraig DNN Creative Staff
 Nuke Master II Posts:2357

 |
| 24 Feb 2008 10:16 AM |
|
I haven't ever tried to do something like that, but you might find it easier to use
DotNetNuke.UI.Skins.PortalSettings.ActiveTab.SkinPath
directly.
The error message that you received seems to indicate that skinpath isn't accessible directly in the container.
Are you trying to put some IE-specific stuff in a container to solve a problem? You might want to take a look at the recent issues of DNNCreative that deal with skin creation:
Lee deals specifically there with creating module level files to deal with specific browser issues.
|
|
Joe Craig DNN Creative Support Subscribe to the website |
|
|
andyb1979
 Nuke Pro Posts:62
 |
| 01 Mar 2008 4:53 PM |
|
Hi Joe,
Thanks for your reply. I've been playing around with just getting my skin.css/container.css file to work in one browser so far(!!) - but Im coming to the point where I need to add a few extra stylesheets.
I *think* its possible to do this in the code-behind. Being a newbie to asp.net Im really stabbing in the dark. I found a snippet here:
http://www.velocityreviews.com/forums/t89859-dynamically-add-link-to-css-stylesheet.html
HtmlGenericControl link = new HtmlGenericControl("LINK"); link.Attributes.Add("rel","stylesheet"); link.Attributes.Add("type","text/css"); link.Attributes.Add("href","mydefinedstyle.css"); Controls.Add(link);
However, the namespace you gave me doesn't exist on my installation of dotnetnuke? (Im running on a local development machine in VWD2008).
In DotnetNuke.UI.Skins I only have:
Controls, CustomAttribute, NavObjectBase, Skin, SkinControl, SkinController, SkinFileProcessor, SkinInfo, SkinObjectBase, SkinThumbnailControl.
Thanks,
AndyB
|
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
andyb1979
 Nuke Pro Posts:62
 |
|
jncraig DNN Creative Staff
 Nuke Master II Posts:2357

 |
| 01 Mar 2008 5:38 PM |
|
Andy,
My general rule is to NOT encourage newbies to step outside of the existing framework too quickly. Instead, study the framework and see how to use it to accomplish what you need. Rarely is it necessary to make additions. I'm still not understanding why you need to load extra css files.
The tutorials I mentioned in my last message show how you can load additional css files for specific tasks. There are also skin files available that change "on the fly." These probably border on stepping outside of the framework, but they do show you some things that can be done.
On the other hand, if you have a solution and it doesn't break other things, more power to you! |
|
Joe Craig DNN Creative Support Subscribe to the website |
|
|
andyb1979
 Nuke Pro Posts:62
 |
| 02 Mar 2008 10:31 AM |
|
Well, Im not trying to serve extra skin files, but I am trying to attach some browser-specific CSS to make my skin work across browsers.
In particular my container is a rounded elastic rectangle with png drop-shadow. This won't work in IE6 or below so I have a different css file that serves GIFs. So the additional CSS files only have a few overrides for rules that don't work in certain browsers.
I wanted to do it without javascript as if someone has JS off then your css file doesn't get served. I will check out those tutorials though as Im still having trouble attaching the css for the container (for the skin it works perfectly).
|
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
andyb1979
 Nuke Pro Posts:62
 |
| 03 Mar 2008 4:35 AM |
|
Wait - this issue has been resolved. See the thread here: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/109/threadid/209121/scope/posts/Default.aspx
this.SkinPath in the container code-behind points to the current container directory 
Apologies if I didnt explain the problem well enough and thanks for your help,
AndyB |
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
jncraig DNN Creative Staff
 Nuke Master II Posts:2357

 |
|
leesykes DNN Creative Staff
 Nuke Master III Posts:3352
 |
|
andyb1979
 Nuke Pro Posts:62
 |
| 05 Mar 2008 12:42 PM |
|
Hi Lee,
Sure, no problem. To be honest, Im really surprised no-one seems to have thought of it already. I'm a .NET developer (not ASP.NET) so I wanted to stay away from horrible javascript and ended up going down this route.
Anyway, I posted an example here on this forum (from memory):
http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/109/threadid/209121/scope/posts/Default.aspx
Is this any good? If not I can come up with a proper code example for you, but give me a couple of days as Im really busy at present!!
Andrew |
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
leesykes DNN Creative Staff
 Nuke Master III Posts:3352
 |
|
andyb1979
 Nuke Pro Posts:62
 |
| 06 Mar 2008 7:54 AM |
|
Sure, no problem. I'm actually working on a skin for a non-profit organisation, so if I just send you a copy of that where Im up to at the moment, it should be enough to demonstrate the concept.
There is one thing Im still struggling on though - which is quite critical to the success of this method. In my skin_IE6.css file, Im trying to apply the DXImageTransform to load PNGs in certain cases, but its not working - I just see a blank area.
So in the main skin.css file, I apply the PNG as a background image (this skin is seen by firefox etc...), then in the skin_IE6.css file, I override it like this
.nav_bar_right { background:transparent; filter:progid: DXImageTransform.Microsoft.AlphaImageLoader( src='/images/nav_bar_right.png', sizingMethod='scale'); }
In fact, when I apply this fitler directly in the original skin.css file (so no extra css files added, just set the filter in the original skin) and load the webpage in IE6/7, I still just see a blank area.
I know the css class is being applied as if I set background:#f00 it changes colour, but the filter doesnt seem to work.
I remember reading somewhere that the URL of the png image for the DXImageTransform must be absolute to the wwwroot directory, but I tried that and it also didnt work, e.g.
.nav_bar_right { background:transparent; /* Resolve to absolute skin path */ filter:progid: DXImageTransform.Microsoft.AlphaImageLoader( src='/Portals/_default/RRR2008/images/nav_bar_right.png', sizingMethod='scale'); }
^^ That also has no effect even if I put it in the original skin.css file, so its not related to adding additional css files.
Do you have any ideas about that? I'd ideally like to resolve the png's using CSS alone, with no javascript.
Thank you,
AndyB
|
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
andyb1979
 Nuke Pro Posts:62
 |
| 07 Mar 2008 2:45 PM |
|
I fixed this (PNG filter in CSS file).
You have to add the full path to the image as follows:
#nav_bar_shadow { background:transparent; filter:progid: DXImageTransform.Microsoft.AlphaImageLoader(src='/rockrhymereason/Portals/_default/Skins/RRR2008/Images/nav_bar_shadow.png',sizingMethod='scale'); }
where my site is http://localhost/rockrhymereason/ |
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
jcator DNN Creative Magazine Subscriber
 Nuke Newbie Posts:5
 |
| 07 Jul 2008 2:23 PM |
|
Thank thank you, I pulled my hair out I read the first part of the post and when I would use view in browser from visual developer the pictures displayed perfect. It did not work however in DNN, fortunatly I read the rest of the post, how strange; with the full path works great now.
Thank you |
|
|
|
|
andyb1979
 Nuke Pro Posts:62
 |
| 07 Jul 2008 3:08 PM |
|
| When you deploy your skin on a server, make sure you change the path again. I used the .NET Method Server.MapPath to find what was the actual path of my DotNetNuke installation. I wrote a small method in the code-behind to load in the css file, swap out a token <%= SkinPath %> for the actual server path and then serve the modified CSS file. |
|
Sites I made thanks to DNNCreative vids! Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster |
|
|
jcator DNN Creative Magazine Subscriber
 Nuke Newbie Posts:5
 |
| 07 Jul 2008 10:32 PM |
|
Anyone know how to make this work in a pure css skin like red leaf? |
|
|
|
|
jcator DNN Creative Magazine Subscriber
 Nuke Newbie Posts:5
 |
| 08 Jul 2008 1:41 PM |
|
| I got it also with css skin filter works same slightly diffrent strategy was needed. |
|
|
|
|