473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

path reference issue with a single masterpage and subfolders on a

There is probably some simple answer to my question, but i'm still new to
this a bit..

I have a master page.. with a menu system which is coded onto the
masterpage.aspx... it uses A tags with hrefs etc.. the usual stuff..

I also have a sub section on the site.. where aspx files arent in the
root.. ie: /rootfiles.aspx here.. then /subsection/subfiles.aspx

The menu is fine and dandy with the usual relative references like <a
href="default.aspx" for the root page.. but when you are say
/subsection/subfiles.aspx all the menu items paths are incorrect.

So at this point i figure i have two or 3 choices.. I could one, make a
seperate masterpage in the subsection (not desired).. or.. I can just do a
search in the request.path variable for the word "subsection" and if it
exists, then dynamically change all the menu items href paths to the correct
format.. ie: if in a subsection, href becomes ./default.aspx for the root
page..

In doing this second option, it seems i have to do the same thing on the
masterpage.aspx.. as there is a <link css/file.cssreference in there and
this cant be changed, only on the aspx file itself (ie: i cant reference it
in codebehind in the page load event).

Any thoughts on this? If these options are the best ones.. would it be a
bad idea to make all the menu links runat="server", so that i can access the
href property from the page load event and set all the values in that
procedure.. or would i be just as good to do all the checks in the embedded
c# code in the aspx page itself.. albeit a bit more messy but all client side?

Thanks

Jun 27 '08 #1
1 1781
For server side controls, you could also use a path such as
~/mydir/myfile.aspx (note the leading ~ symbol) to create application root
relative URLs...

Try http://msdn2.microsoft.com/en-us/library/ms178116.aspx for details...
--
Patrice
"markm75" <ma*****@discussions.microsoft.coma écrit dans le message de
groupe de discussion : B3**********************************@microsoft.com...
There is probably some simple answer to my question, but i'm still new to
this a bit..

I have a master page.. with a menu system which is coded onto the
masterpage.aspx... it uses A tags with hrefs etc.. the usual stuff..

I also have a sub section on the site.. where aspx files arent in the
root.. ie: /rootfiles.aspx here.. then /subsection/subfiles.aspx

The menu is fine and dandy with the usual relative references like <a
href="default.aspx" for the root page.. but when you are say
/subsection/subfiles.aspx all the menu items paths are incorrect.

So at this point i figure i have two or 3 choices.. I could one, make a
seperate masterpage in the subsection (not desired).. or.. I can just do a
search in the request.path variable for the word "subsection" and if it
exists, then dynamically change all the menu items href paths to the
correct
format.. ie: if in a subsection, href becomes ./default.aspx for the root
page..

In doing this second option, it seems i have to do the same thing on the
masterpage.aspx.. as there is a <link css/file.cssreference in there and
this cant be changed, only on the aspx file itself (ie: i cant reference
it
in codebehind in the page load event).

Any thoughts on this? If these options are the best ones.. would it be a
bad idea to make all the menu links runat="server", so that i can access
the
href property from the page load event and set all the values in that
procedure.. or would i be just as good to do all the checks in the
embedded
c# code in the aspx page itself.. albeit a bit more messy but all client
side?

Thanks
Jun 27 '08 #2

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

Similar topics

3
by: Kali K E | last post by:
Hi, I could not understand how I can do the following things in Python. Please help me. 1. First I have to find the current directory from where the script is invoked. 2. Next I have to form a...
3
by: Ben Allfree | last post by:
Written to normalize web server path names based on a virtual root. I propose that something equivalent to this be added to os.path ------------------------------------- import os.path import...
2
by: Yang Liu | last post by:
Hi all, I have a .net windows application xx.exe, which reference a private assembly yy.dll, the property "local copy" of the yy.dll reference is automatically set to true, so the yy.dll will be...
1
by: Shikari Shambu | last post by:
Hi, I have an ASP.NET application that has multiple folders (maps to directories under the rootweb). When my code tries to access a control that is under /common folder I get the following error ...
6
by: Mirek Endys | last post by:
HEEELP!!!! I have a big problem :))))) How to use url in CSS stylesheet file that is linked into MasterPage. The tilda '~' (as shortcut to the root of the webserver) is not working, and my...
13
by: Michael | last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I would like to set that value from the UserControl, but I can't seem to find a way to do this. Does anyone have any ideas?...
2
by: Sean | last post by:
We have a Master page problem that comes around time and time at work and it’s a problem that has been confirmed by other developers on the project I have been on. Additionally I have had the...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
0
by: saukpatthanshwe | last post by:
In myproject, there are three Master Pages under Master Folder. And I have many subfolders storing aspx pages which use that MasterPages. The Problem is that aspx pages in the root directory , the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.