Thank you very much for this post. I just have a question because I am still a novice at asp.net.
I was wondering how to make a codebehind file inherit the DotNetNuke.UI.Skins.Skin. I know how to make the ascx use a different codebehind file.
If my skin is blue.ascx and my code behind file was css.cs then the top line would be as follows I would think.
<%@ Control language="c#" CodeBehind="css.cs" AutoEventWireup="false" Explicit="True" Inherits="css" %>
And this is my css.cs file
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
/// <summary>
/// This is used for conditional comments for CSS
/// </summary>
public partial class css : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string cssFixFile = null;
// Note, "Firefox", "Opera", "Netscape" can all be detected using this method.
if (Request.Browser.Browser.Equals("IE"))
{
// IE detected
//
if (Request.Browser.MajorVersion == 7)
{
// IE7 detected - create a full path to the skin_IE7.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE7.css");
}
else if (Request.Browser.MajorVersion == 6)
{
// IE6 detected - create a full path to the skin_IE6.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE6.css");
}
else if (Request.Browser.MajorVersion == 5 && Request.Browser.MinorVersion == 5)
{
// IE5.5 Detected - create a full path to the skin_IE5_5.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE5_5.css");
}
else if (Request.Browser.MajorVersion <= 5)
{
// IE5 or less detected - create a full path to the skin_IE5.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE5.css");
}
// etc... more browser detection possible
}
// Load in the CSS file for the browser
if (cssFixFile != null)
{
// If a CSS file is needed, this part loads it in
HtmlGenericControl link = new HtmlGenericControl("LINK");
link.Attributes.Add("rel","stylesheet");
link.Attributes.Add("type","text/css");
link.Attributes.Add("href", cssFixFile );
Controls.Add(link);
}
}
}
I am not sure I need all those namespaces, but I figured this would be the best place to ask. Also I am not sure where to put the inheritance of DotNetNuke.UI.Skins.Skin in my css.cs file.
I am sorry I am asking dumb questions. Like I said, I am still a novice at asp.net and have written only a few web apps in C# using asp.net.
Thanks and I am sorry to bug you.
~Morty