CSS not accessable from content page when Master Page and Content Pages are in different folder.

I can't seem to find a solution to this problem.  I have a master page and content pages and a CSS file all in the root folder.  I have created a sub folder called News and have added a content page that references the master page in the root directory with the following: MasterPageFile="~/Default.master".

The issue is that the page in the News folder is not picking up the CSS styles from the master page.  Has anybody else ran into a problem like this and was able to find a solution?

Any help would be greatly appreciated?

Thanks,

Neeraj

 

0
rapidfire09
10/30/2007 3:14:55 PM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

3 Replies
1133 Views

Similar Articles

[PageSpeed] 10

 Neeraj--

If you want a consistent theme to apply throughout the entire Web site or Web application, I would suggest placing your CSS files within the folder, App_Themes and within a sub folder. Label the folder any name you wish. That is the most rudimentary basics for creating an asp.net Theme.  Place the following line of code into your web.config file: <pages theme="Insert Name of Theme Folder">.  More explicit example:  

<configuration>
    <system.web>
       <pages theme="MainTheme"> 
    </system.web>
</configuration>

You could also place the Theme reference within your Master Page directive, e.g. Theme="MainTheme"  You may want to consider the first method if you ever want to specify a separate theme for any individual page by specifying a theme within the individual page directive.

Themes, skins and styles are very versatile in .NET and they can get confusing at times.

 

0
that
10/30/2007 10:17:55 PM

It would be better if you create a App_Themes Folder!

 how to do this?

 in your explorer scroll up to the "world icon" where the directory of the project is shown

at this item click right and chose " ad asp net folder"

then you have to select "Design"

now ther should exist a "App_Themes" folder

and a subfolder, if not u can create it, name it whatever suites u well

then copy your .css file to this folder

now  ad the "StylessheetTheme" tag to your page-event

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" StylesheetTheme="Design1" %> 

"Desgin1" means here the folder in which the css file is stored

visual studio automatically then gets the css-file 

 

this should activate the css style in your page

greetings 

 

0
hurzwurz
10/31/2007 10:50:29 AM

 Hi,

You may create an folder to place your CSS files in the App_Themes. You can add the App_Themes by right clicking the project in the Solution Explorer and adding ASp.NET folder.

You can call this folder any name. Let's say you called this 'MyStyle'.

Then go in the Web.Config file and make the following change.

 

<system.web>
          .

          .
        <pages theme="MyStyle"></pages>

         .

         .
 </system.web>

 This  should solve the problem.

Please let us know if this solved the issue.

Thanks

Chris. 

0
chryste
10/31/2007 10:59:01 AM
Reply:

Similar Artilces:

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLI...

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted her...

Show content in both Master Page ContentPlaceholder AND Content Page Content control
I note that by default or rendering rules, when you add content/controls to the Content Page ASP:Content control matched to a Master Page ContentPlaceholder, any content/controls in the matching Master Page ContentPlaceholder is not displayed. Is there a setting that can be made to merge or show both content/controls in the Master Page ContentPlaceholder and content/controls in the matching Content Page Content control? Thanks         Don't think so. If you specify a content control in your page then whatever is in there displays and anything in the...

convertion from page to content page or from user control to content page
Hi, I have converted an asp.net 1.1 application to 2.0.  Now what I am looking for some enhancement.  I added a master page and now I want to add other pages as content pages. but those pages which I am converting into content have some user control. Now either I can convert those user control to content pages ( which i want to look for if it is possible),  Or I am thinking i shouldn't convert those user control to content pages cause they might be just good. So looking for some of those people opinion who have worked through this so can I get opinion here please.thanks&nb...

Accessing master page controls from content page
Hello,Here's a snippet from my listing.master page:<%@ master Language="C#" %>     public string Listing_Name    {        get { return lis_name.Text; }    }    protected void Page_Load(object sender, EventArgs e)    {       lis_name.Text = "Hello World"    } ---------------------------------------------------------------------------------------------------------------In my content page, Master.Listing_Name shows blank, why?<...

Access Content Page Control from Master Page
I use Master page in my application. i want to access the content page control (Text Box)  from master page and change the control (Text Box) value. i cant find the text box by using Findcontrol also Let’s turn to the FindControl documentation on MSDN. FindControl searches the current naming container for the specified server control. Master.FindControl("ContentPageHolder1").FindControl(TextBox) Reading this nice article.http://odetocode.com/Articles/450.aspx   MPI never desire to converse with a man who has written more than he hasread. -Samuel Johnson, lexic...

Content page accessing master page controls?
I'm probably that much of a noob that I've deviated from the path authors of ASP.NET 2.0 thought of how master and content pages should off been used... Looking from the outside it seemed logical to me that (even on this website) a search text box should be part of a master page and a page that displays results should be a content page... So the problem I'm having (if my hunch about that search textbox control in the header of say even this very website being part of a master page, and result page that subsequently loads underneath the header after you click go bei...

Accessing Content Page Control From Master Page
I'd like to access the value of a control residing on a content page from the associated master page. Can anyone point me in the right direction?   Thanks When you know the classname of your page, use: (in VB.NET) CType(Page, classname).ControlID.propertyName But this code will go wrong on all the other pages, so you have to check on which page you are. This being said, I advise you to consider another approach.Your master page should not use code that depends on the design of a particular content page. Your content pages should depend on your master page, not the other ...

Accessing Controls Content Pages from Master Page
how do i access controls content pages from master page?Its all about coding! I would raise an event from the master page and handle it on the content page.  You can commuicate any data through customized event args.  This article explains in detail how to raise and consume an event: http://msdn2.microsoft.com/en-us/library/9aackb16(VS.80).aspx  HTH,Phillip Williams,http://www.webswapp.com Let's say your master page has a textbox whose ID is MasterTextBox. TextBox tb = Page.Master.FindControl("MasterTextBox") as TextBox;...

Master page and content page in different folders
I can't seem to find a solution to this problem.  I have a master page and content pages and a CSS file all in the root folder.  I have created a sub folder called Admin and have added a content page that references the master page in the root directory with the following: MasterPageFile="~/Default.master". The issue is that the page in the admin folder is not picking up the CSS styles from the master page.  Has anybody else ran into a problem like this and was able to find a solution? Any help would be greatly appreciated? Thanks, Russ  ...

Content controls are allowed only in content page that references a master page.
HiI'm getting the above error with my application.Basically I had a master file and then some page files referencing the master file.In the page files I had some ajax controls so had :<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><atlas:ScriptManager ID="ScriptManager1" runat="server"></atlas:ScriptManager>in them.but when I try adding an ajax control to the master file and putting the above code in, it shows the error messagewhy would this be?thanks!  Make sure you have prop...

Using an Update Panel in a Content page of Master.page/content.page scenario
When I place an Update Panel inside a content page of a Masterpage I get the following error: Element 'UpdatePanel' is not a known element. This can occur if there is a compilation error in the Web site.  Is the Update Panel suppose to work with a content page, etc.?  Can't seem to find any Docs that talk about where the Update Panel is allowed. Warren     Well, don't you know it.  Right after I put out the original post, I then downloaded the latest release of the ajax extensions and it looks like they have fixed the problem with the update panel not working ...

How to access a control in the Content Page from javascript in Master Page?
How do I access a control in the Content Page from javascript in Master Page? Say, I have a dropdown list 'CountryDDL' in my Content Page. When I click on a button in the Content Page, I call a javascript function. The javascript file is included in the master page. From within this javascript function, I have to access CountryDDL and find the selected index etc... Because of Master page - content page hierarchy, document.getElementById('CountryDDL') doesnt seem to work. Is there  any alternate approach? use  document.getElementById('<%Countr...

Web resources about - CSS not accessable from content page when Master Page and Content Pages are in different folder. - asp.net.navigation-controls

App Store - TrafficCamNZ Free
Read reviews, get customer ratings, see screenshots, and learn more about TrafficCamNZ Free on the App Store. Download TrafficCamNZ Free and ...

Command-line interface - Wikipedia, the free encyclopedia
A command-line interface (CLI) is a means of interaction between a human user and a computer program , or between two programs, where the user ...

Protest leads to complaint over cafe
Protest leads to complaint over cafe

Sydney Restaurants Guide - Discover Sydney - Sydney Accommodation
Sydney has some very talented renowned Chefs that are constantly creating innovative, mouth watering delights. Australia's unique native cuisine, ...

The Boat - Temptation Sailing
'Temptation' is a 58ft x 32 ft aluminium high performance sailing catamaran, which was built by the owner/operator in Adelaide, South Australia. ...

Adafruit Pi Dish for Raspberry Pi - Includes Breadboard ID: 942 - $22.50 : Adafruit Industries, Unique ...
Adafruit Industries, Unique & fun DIY electronics and kits Adafruit Pi Dish for Raspberry Pi - Includes Breadboard ID: 942 - By popular demand! ...

Modifying homes for later years
Stylish brushed nickel grab bars, wood floors and an open, airy design hide the utilitarian Aging in Place function of this Atlanta bathroom. ...


Marijuana: To legalize or not to legalize, that is the question (Video)
6.19.12]Cannabis. Ganja. Cali Herb. Roofie. The Holy Herb. Weed. Blunt. Bud.  Tampee. Kush.  Reggi Bush. All the aforementioned are names given ...

HTC DROID Incredible 4G LTE hands-on
Unlike the new Samsung Galaxy S III, the new HTC DROID Incredible 4G LTE has been leaked more times than I can count. Even though we've seen ...

Resources last updated: 11/26/2015 8:28:52 PM