Using a CSS stylesheet in 2.0

I am trying to use a style sheet for my application.  It works perfectly fine is the sheet is in the same folder as the form.  This will mean that I have to have a different style sheet for every folder that I have.  I would like to use one sheet for the whole project.  

Right know the html code that i am using to call the sheet is :

<LINK href="DataSearch/BeyondAbilitiesStyles.css" type="text/css" rel="stylesheet">

I would like to just use the sheet I have in my root directory.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<LINK href="/styles.css" type="text/css" rel="stylesheet"> gets styles.css from the root of the site ie: http://localhost/styles.css
jrhundsrAuthor Commented:
No that didn't work
Does http://localhost/style.css (using whatever server/style sheet name you use) actually exist, ie if you browse to it does it show all the style information?
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

jrhundsrAuthor Commented:
jrhundsrAuthor Commented:
and it will work if I move the style sheet into the same folder as the form
Jason ScolaroCommented:
Hi jrhundsr,

Can you tell us your folder structure?  crisco's comments will work if everything is setup right.  So let's say you have this structure:


And we're working with Default.aspx, to bring the page up in the browser we type:


If we're all clear so far, then within Default.aspx if you reference:

<link href="/MyWebApplication/BeyondAbilitiesStyles.css" type="text/css" rel="stylesheet" />

It should work.... and then if you have a new page at:

c:\inetpub\wwwroot\MyWebApplication\AnotherFolder\AnotherPage.aspx --> http://localhost/MyWebApplication/AnotherFolder/AnotherPage.aspx

Then the same <link> should work.  I hope that helps clear things up.

-- Jason

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jrhundsrAuthor Commented:
This is where the form is located

This is where the style sheet is located

When I put in <LINK href="/BeyondAbilities/BeyondAbilitiesStyles.css" type="text/css" rel="stylesheet">

it will show when I look at the web page but not in the designer
Jason ScolaroCommented:

I think that's the best you're going to be able to do with a global sweep of the hand... you could try this, knowing you'll have to tweak it for each different subfolder:
<LINK href="../../../BeyondAbilities/BeyondAbilitiesStyles.css" type="text/css" rel="stylesheet">

That might allow you to see it in both designer and on the page.

-- Jason
This might work:
<LINK href="~/BeyondAbilities/BeyondAbilitiesStyles.css" type="text/css" rel="stylesheet" runat="server">
Jason ScolaroCommented:

I was just about to type that out as a possible alternative, crisco... :-)  You're too quick for me!

-- Jason
lol sorry about that :)
jrhundsrAuthor Commented:
It's saying that it cannot find the file when I use either of those two
Jason ScolaroCommented:

I think you're going to have to live with the working on the page, and not in the designer... the designer isn't perfect, unfortunately.  Or if you need it to work, perhaps posting another question specific to that issue would get some other experts that have experienced it involved.

-- Jason
jrhundsrAuthor Commented:
ok thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.