Solved

css not applied at runtime

Posted on 2008-10-14
21
1,759 Views
Last Modified: 2013-12-17
I am attaching a css to and ASPX file.
Design time I see the css style,  when I run application I do not see the style.
Following is the line that attaches the css to the page.
________________________________________________________
<head runat="server">
    <link rel="stylesheet" type="text/css" href="css/login.css" />
</head>
0
Comment
Question by:vu3lmg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 9
21 Comments
 
LVL 4

Expert Comment

by:Jerrod_W
ID: 22712814
You could try to move the CSS file into the current directory. Or you can try:

<head runat="server">
    <link rel="stylesheet" type="text/css" href="/css/login.css" />
</head>

the slash in front of the directory is necessary sometimes.
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22712914
1. Switch to the Source view (HTML view)
2. Select your css file from the solution explorer
3. Drag & drop your css file (login.css) into the <head> section.
4. Does it look the same as you posted earlier?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22712963
Tried to move in current dir - did not work.
put a "/" in the front - did not work.
More ideas please.
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 1

Author Comment

by:vu3lmg
ID: 22713001
prairiedog,
the drag drop of the css looks the same.
Chandresh
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22713016
Are you using any Master page?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22713225
prairiedog
Yes there is a master file.
I want to load that file after successful login.
Attached is the login.aspx file
Chandresh
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>PAM Browser</title>
    <link href="css/login.css" rel="stylesheet" type="text/css" />
</head>
<body class="loginoverallback">
    <form id="form1" runat="server">
        <div>
            <asp:LoginView ID="LoginView1" runat="server">
                <LoggedInTemplate>
                    You are already logged in
                </LoggedInTemplate>
                <AnonymousTemplate>
                </AnonymousTemplate>
            </asp:LoginView>
            &nbsp;<asp:Login ID="Login1" runat="server" DisplayRememberMe="False" Font-Bold="True"
                Font-Names="Arial" RememberMeText="" Width="361px">
            </asp:Login>
            <asp:LoginStatus ID="LoginStatus1" runat="server" LoginText="" LogoutText="" />
        </div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22713298
Confused. What file do you want to "load"? What do you mean "load"?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22713329
prairiedog
I want to load Login.aspx file, after a successful login,  I want to load the master file.
Chandresh
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22713444
1. I don't see your Master page.
2. Login.aspx is just a regular web page.
3. Can you post your css file?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22713711
prairiedog,
1,2 Sucessful login loads "Default.aspx" which is contained in the master page.
3 Attached is the Login.css.
.loginoverallback {
	background-color: #00476D; 
	background-image: url(../images/login/login_overallback.jpg);
	background-repeat: no-repeat;
}
 
.loginversiontext {
	font-family: Verdana;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
 
 
.loginerrortext {
	font-family: Verdana;
	font-size: 12px;
	font-weight: bold;
	color: #FDFFB9;
	line-height : 20px;
} 
 
 
.logintext {
	font-family: Verdana;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
 
.logininputtext {
/*	font-family: Verdana;
	font-size: 12px;
	font-weight: bold;
*/	color: #000000;
  	BORDER-RIGHT: #00476D 1px solid; 
   	BORDER-TOP: #00476D 1px solid; 
   	BORDER-LEFT: #00476D 1px solid; 
   	BORDER-BOTTOM: #00476D 1px solid;
}
 
 
.logininputbutton {
	font-family: Verdana;
	font-size: 11px;
	font-weight: bold;
  	BORDER-RIGHT: #FFFFFF 1px solid; 
   	BORDER-TOP: #FFFFFF 1px solid; 
   	BORDER-LEFT: #FFFFFF 1px solid; 
   	BORDER-BOTTOM: #FFFFFF 1px solid; 	
	CURSOR: hand;
	background-color: #00476D;
	color: #FFFFFF;
	width: 50px;
}

Open in new window

0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22714063
Try assigning class="loginoverallback" to the <div> tag, instead of the <body> tag.
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22720183
prairiedog
Did not work (assigning the class to <div> tag).  Same results.
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22720732
I am still confused, sorry. Let me confirm this: it is login.aspx that does not show the style, right? After user logs in, they will be redirected to default.aspx?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22721138
Yes, you are right
Login.aspx does not show the style at runtime.
At design time it does show the style.
0
 
LVL 22

Accepted Solution

by:
prairiedog earned 500 total points
ID: 22721298
It seems that this line is causing the problem:
background-image: url(../images/login/login_overallback.jpg);

Make sure the rul is correct. I would try removing "../" first.
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22730291
Attached is the zipped folder of part of my project.
I am having problems with this as well
Please have a look at it.
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22730345
I am not able to attach the zipped folder.  Is there a way to send you the code.
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22730703
All files uploaded here have to be in plain text format.
Have you tried changing background-image: url(images/login/login_overallback.jpg);
 
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22732021
Yes I tried changing background-image: url(images/login/login_overallback.jpg);
Strangly, I copied the project to another PC and it works there !!
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 22732133
With the same folder structure and hierarchy?
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 22734492
Strange
Now it works on my PC as well.   Even with ../  or without !!
Let me know if you have any more ideas or I will close this by accepting one of your suggestions.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question