473,651 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master Pages and content pages in subfolder

Hi,

I am still new to ASP.NET 2.0 and trying to develope something using
Master pages.

My problem is:
I have a master page that contains Logo image and a navigation menu at
the top of the page so that this will be displayed on all the content
pages automatically.
This works fine for the content pages that are stored in the same
folder as that of Master page.

But I have a content page that is stored in a sub-folder (not in the
same folder as that of master page). Because of this, the contents
inherited from the master page (images/hyperlinks on master page) are
not rendered on content page. The reason being their relative paths
become invalid as my content page is inside a sub-folder.

How to resolve this issue? Do I have to mention the path for images
(and other relative paths) on master page using some different
technique (using ~ or something of that sort?)
thanks.

Oct 13 '06 #1
3 6332
"vikramp" <vp****@gmail.c omwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
How to resolve this issue? Do I have to mention the path for images
(and other relative paths) on master page using some different
technique (using ~ or something of that sort?)
Do yourself a *HUGE* favour and design your web app so that everything is at
the same level off the root, e.g.

<root>
\bin
\css
<stylesheets go here>
\folder 1
<content goes here>
\folder 2
<content goes here>
\folder n
<content goes here>
\includes
<include files e.g. JavaScript etc go here>
\master
<master pages go here>
default.aspx
Global.asax
Web.config
Oct 13 '06 #2
vikramp wrote:
But I have a content page that is stored in a sub-folder (not in the
same folder as that of master page). Because of this, the contents
inherited from the master page (images/hyperlinks on master page) are
not rendered on content page. The reason being their relative paths
become invalid as my content page is inside a sub-folder.
<img runat="server" src="~/images/my-pic.jpg" />

Oct 13 '06 #3
Hi apathetic,

thanks for the solution. It worked fine using ~ to specify the path.
apathetic wrote:
vikramp wrote:
But I have a content page that is stored in a sub-folder (not in the
same folder as that of master page). Because of this, the contents
inherited from the master page (images/hyperlinks on master page) are
not rendered on content page. The reason being their relative paths
become invalid as my content page is inside a sub-folder.

<img runat="server" src="~/images/my-pic.jpg" />
Oct 13 '06 #4

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

Similar topics

5
2417
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
1
1863
by: Alan Silver | last post by:
Hello, I am just experimenting with master pages, and am trying to add a content placeholder in the <head> section, so that individual pages can set their own page title and meta tags. The master page looks like this... <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
1
4022
by: michael.bollhoefer | last post by:
I was running into issues with the images on the page not working under sub folders. If you leave a master file in the root folder and place content pages in the subfolder then when you hit a subfolder page the images and javascript break. I then changed all the images on the page to <asp:image ~/images/imageName.gif>. THat fixed my image problem. Now when the page is rendered it converts the ~ into .. or ../.. However, I have not found...
17
3149
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content pages? Kinda sorta a critical point no? Am I missing something? Rob. P.S. the day I find a book that actually is useful rather than just a
3
5376
by: Laith Zraikat | last post by:
I need to set the page title for a content page in a master page, and do that using local reources so that I can have my page title in different languages. I can do that easily using global resources by explicitly setting the value of the Page, but I want to use local resources as a standard. Thank you.
0
1064
by: romaricr | last post by:
Hello, We are having issues with namespaces. Here is what we do: - We set a namespace for our project and pages (something like 'group.project.component.folder.subfolder.page) - We add a master page to each and every pages - When we add some controls to the page, their ID (the short one) is not recognised by Visual Studio.
1
1272
by: jobs | last post by:
I've got an asp.net 2.0 website that has a master page and content pages. For announcemnts, users modifiy plain old html pages that I then can bring into a div tag of a content page using the following vb.net code: Dim htmlin As String = System.IO.File.ReadAllText(Server.MapPath(".\") + e.CommandArgument)Announcements.InnerHtml = htmlin My question, what's the best way to allow users to edit and save a native word document file so...
16
1896
by: IfThenElse | last post by:
Hi, I have a web page in a subfolder that inherits a Master page at the root. the webpage in the subfolder can not see the Master page. This is what I have in my webPageThatIsInSubfolder.aspx MasterPageFile="~/myMasterPage.Master" Tried,
3
3944
by: shiyas | last post by:
I have an aspx page named PartSearch.aspx. This is in root directory. I want to popup this page using window.showModalDialog from master page (by clicking a Hyperlink in master page) . So from master page i am using the following function using java script in hyperlink onClientClick event var strURL = "PartSearch.aspx"; var strReturn = window.showModalDialog(strURL,null,'status:yes;dialogWidth:550px;...
0
8347
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
8792
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
8694
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
8457
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
8571
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...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
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.