473,606 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic ASP style sheet not working

I am using a asp page to dynamically create a stylesheet

my asp page creates the following css element when i call the asp page my
typing the url in the browser. My asp page works fine........... .

body {
font-family : Arial, Helvetica, Sans-Serif, Verdana ;
margin : 0 ;
padding : 0 ;
}
..portal_nav {
margin-right : 30px ;
margin-top : 3px ;
}
#white_bar_1 {
height : 6px ;
width : 985px ;
background-color : #B32B3F ;
}
#white_bar_2 {
height : 8px ;
width : 985px ;
background-color : #B32B3F ;
}

my code goes like this for setting the stylesheet in ASP.NET master page

HtmlLink link1 = new HtmlLink();

if (null != Request.QuerySt ring["CID"])
{
clientId = Request.QuerySt ring["CID"];
Session["CID"] = clientId;
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else if (Session["CID"] != null)
{
clientId = Session["CID"].ToString();
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else
{
//Going to default CSS
}
link1.Attribute s["text"] = "text/css";
link1.Attribute s["rel"] = "stylesheet ";
Page.Header.Con trols.Add(link1 );

my stylesheet setup in web.config is <pages theme=""</page>

when i see the view source code when the page is rendered i see the <link>
element with the proper url............ but none of the style settings are
set to any of the controls....... .........

Anyone has any idea....why this is happening...... .......need help badly
Mar 5 '08 #1
3 2931
Suba wrote:
I am using a asp page to dynamically create a stylesheet

my asp page creates the following css element when i call the asp page my
typing the url in the browser. My asp page works fine........... .

body {
font-family : Arial, Helvetica, Sans-Serif, Verdana ;
margin : 0 ;
padding : 0 ;
}
.portal_nav {
margin-right : 30px ;
margin-top : 3px ;
}
#white_bar_1 {
height : 6px ;
width : 985px ;
background-color : #B32B3F ;
}
#white_bar_2 {
height : 8px ;
width : 985px ;
background-color : #B32B3F ;
}

my code goes like this for setting the stylesheet in ASP.NET master page

HtmlLink link1 = new HtmlLink();

if (null != Request.QuerySt ring["CID"])
{
clientId = Request.QuerySt ring["CID"];
Session["CID"] = clientId;
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else if (Session["CID"] != null)
{
clientId = Session["CID"].ToString();
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else
{
//Going to default CSS
}
link1.Attribute s["text"] = "text/css";
link1.Attribute s["rel"] = "stylesheet ";
Page.Header.Con trols.Add(link1 );

my stylesheet setup in web.config is <pages theme=""</page>

when i see the view source code when the page is rendered i see the <link>
element with the proper url............ but none of the style settings are
set to any of the controls....... .........

Anyone has any idea....why this is happening...... .......need help badly
link1.Attribute s["text"] = "text/css";

should be

link1.Attribute s["type"] = "text/css";

You may have to add your attributes in the following manner as well:

link1.Attribute s.Add("rel", "stylesheet ");
link1.Attribute s.Add("type", "text/css");

And make sure that your dynamic style sheet is setting the right
content-type.
Mar 5 '08 #2

I modified the code.....but still not working........ .....

link1.Attribute s.Add("rel", "stylesheet ");
link1.Attribute s.Add("type", "text/css");

how to make sure my dynamic style sheet is setting the correct content
type....its a simple asp page........... ....

link1.Attribute s.Add("type", "text/css"); --i thought this takes care of
setting the correct content type........... ...

"Mufaka" wrote:
Suba wrote:
I am using a asp page to dynamically create a stylesheet

my asp page creates the following css element when i call the asp page my
typing the url in the browser. My asp page works fine........... .

body {
font-family : Arial, Helvetica, Sans-Serif, Verdana ;
margin : 0 ;
padding : 0 ;
}
.portal_nav {
margin-right : 30px ;
margin-top : 3px ;
}
#white_bar_1 {
height : 6px ;
width : 985px ;
background-color : #B32B3F ;
}
#white_bar_2 {
height : 8px ;
width : 985px ;
background-color : #B32B3F ;
}

my code goes like this for setting the stylesheet in ASP.NET master page

HtmlLink link1 = new HtmlLink();

if (null != Request.QuerySt ring["CID"])
{
clientId = Request.QuerySt ring["CID"];
Session["CID"] = clientId;
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else if (Session["CID"] != null)
{
clientId = Session["CID"].ToString();
link1.Href = "~/NewClientPortal/stylesheet.asp? CID=" + clientId;
}
else
{
//Going to default CSS
}
link1.Attribute s["text"] = "text/css";
link1.Attribute s["rel"] = "stylesheet ";
Page.Header.Con trols.Add(link1 );

my stylesheet setup in web.config is <pages theme=""</page>

when i see the view source code when the page is rendered i see the <link>
element with the proper url............ but none of the style settings are
set to any of the controls....... .........

Anyone has any idea....why this is happening...... .......need help badly
link1.Attribute s["text"] = "text/css";

should be

link1.Attribute s["type"] = "text/css";

You may have to add your attributes in the following manner as well:

link1.Attribute s.Add("rel", "stylesheet ");
link1.Attribute s.Add("type", "text/css");

And make sure that your dynamic style sheet is setting the right
content-type.
Mar 6 '08 #3
That tells the browser that the link content type should be text/css. I
was referring to your dynamic css page. You may need something like
Response.Conten tType = "text/css" in that page.

Beyond that, I am not sure why it wouldn't work. You can try pointing
your web browser at your dynamic css page and see if what you get is
what you expect.

Suba wrote:
I modified the code.....but still not working........ .....

link1.Attribute s.Add("rel", "stylesheet ");
link1.Attribute s.Add("type", "text/css");

how to make sure my dynamic style sheet is setting the correct content
type....its a simple asp page........... ....

link1.Attribute s.Add("type", "text/css"); --i thought this takes care of
setting the correct content type........... ...
<snip>
Mar 6 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1883
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to. thank you.
1
1653
by: Andrew Poulos | last post by:
I'm using the following to dynamically add a style sheet with larger font sizes: if (document.createStyleSheet) { document.createStyleSheet("extras/styles_large.css"); } else { var oStyle = document.createElement("STYLE"); oStyle.type = "text/css"; var txt = document.createTextNode("@import url(extras/styles_large.css);")
5
2872
by: Gary | last post by:
I am not sure what group to post this to but here goes. I am dynamically creating a web page using perl. I grabbed a style sheet from a free site and hacked it to look the way I wanted. I then stripped out the css code and placed it in a file. I have written my perl script but the browser doesn't seem to be reading the css code. from my perl script: start_html(-title=>"Lamanai - $HEADER", -script=>$SCRIPT,
3
6417
by: Capricorn | last post by:
Hi, can anybody tell me how you can create a new stylesheet inside a (X)HTML page with JavaScript and Firefox, if the stylesheet is only available as a variable value, like: var CSSStyle = "rect {fill: lightgrey;} circle {fill: red;} polyline {fill: none; stroke: red; stroke-width: 0.3;} text {font-size: 2.5px;} text.text-x-axis {text-anchor: middle;}
2
6345
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of 3 ways to do this: 1. Write a script to create a semi-dynamic CSS file, which will be run whenever we need to make changes to the ASP variables controlling the
0
5277
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all the days in the week with dates and textboxes to fill in some data. row 1: question
2
1953
by: David W | last post by:
I need to include a style sheet link in the aspx page based on what user they are. Basically this functionality, but using code behind. Any idea how to change this line to code behind? This breaks once we include an AJAX control on the page. <head runat="server"> <link href="/textfiles/style<%= Session("partner_id") %>.css" rel="stylesheet" type="text/css">
4
4205
by: coconet | last post by:
Server is Win2K3/IIS6. I have an ASPX page with this in the <headtag: <link rel="stylesheet" type="text/css" href="<% Response.Write( "http://" + Request.ServerVariables.ToString() + this.ResolveUrl("~") + "styles/styledefault.aspx"); %>" />
5
10490
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine running IIS 6.0. I just replaced the web.config and several aspx pages in the application and now the style sheets are not working. the images from the themes work but not the css files. Any help. -- Jerry
0
8015
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7951
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5465
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
1296
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.