.NET Framework - path reference issue with a single masterpage and subfolders on a

Asked By markm7
06-May-08 12:52 PM
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  reference 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
Codebehind
(1)
Masterpage
(1)
Markm75
(1)
Albeit
(1)
Arent
(1)
Hrefs
(1)
Runat
(1)
Paths
(1)
  Patrice replied...
06-May-08 01:09 PM
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


groupe de discussion : B3AF55B9-3992-438D-953F-48F02B93FD9E@microsoft.com...
help
MasterPages - take plain form, add MasterPage. MasterPage does NOT appear when run .NET Framework Hi, I now need to add MasterPages to a number of existing forms, but when I add the code for MasterPage, the MasterPage does NOT appear when it runs. Any thoughts? TIA, Randy Smith ASP.NET Discussions Login you say "form", do you mean ASPX page. . .? How do you "add the code for MasterPage". . .? Sorry, but what you saying is not very understandable. I can understand each word separately to add MasterPages. So, I've taken existing aspx.pages and added this code: MasterPageFile = "MasterPage.master" I've made sure that my html form elements are wrapped in: Runat = "Server"> AND . . . . . . . . . . . . . . . . . . . . . < / asp:Content> IN SPITE OF THIS, my MasterPage elements do NOT appear. TIA, Randy Smith So your MasterPage is in the same folder as all your content pages. . .? By "wrapped in", I take
usercontrol methods in master page from content page .NET Framework Hi All I have a masterpage, MasterPage.master with a UserControl on it called MemberEventsControl.ascx. It has a method on it Any help would be greatly appreciated. C ASP.NET Discussions MemberEventsControl.GetMemberEvents (1) UserControl (1) MasterPage.master (1) Chevron (1) GetMemeberEvents (1) GetMemberEvents (1) MyUserControl (1) MyMasterPage (1) It' totally doable attribute on master page and UserControl Then you could do in (C#) ((MyUserControl)((MyMasterPage)this.MasterPage).MyControl).GetMemeberEvents() Also you might have to use following on your page. virtualPath = "path to file" %> So the page becomes aware of the UserControl or MasterPage. It's mostly a hint to compiler what to compile first. George keywords: Calling, usercontrol methods, in, master, page, from, content, page description: Hi All I have a masterpage, MasterPage.master with a UserControl on it called MemberEventsControl.ascx. It has a method on it
Unterschied zwischen der Vorlage Masterpage und AJAX-Masterpage .NET Framework Kennt jemand den Unterschied zwischen einer normalen Masterpage und eine AJAX-Masterpage-Vorlage? Wenn ja, dann wüßte ich den auch gerne. Danke Carla ASP.NET - German Discussions Contentbereichen (1) Contentbereich (1) Scriptmanager (1) Masterpage (1) Masterpag (1) Vorlage (1) Grüße (1) Inhalts (1) Hallo Carla, der Unterschied ist wohl read very infrequently. o.k. Dann war die Frage falsch gestellt. Wenn ich auf der Masterpage eigentlich kein Ajax brauche sondern nur in den Inhalts-Seiten, brauche ich dann eine Ajax-Masterpage? Kann ich AJAX-Seiten und andere problemlos mischen? Hi, nein brauchst du nicht. Wenn du alle Scriptmanager gegen Scriptmanager-Proxy austauschen. Da würde ich dann lieber von vornherein auf der Masterpage einen Scriptmanager installieren und nur bei Bedarf im jeweiligen Contentbereich einen Scriptmanager-Proxy. ja MfG
enctype = "multipart / form-data" for MasterPage .NET Framework I have a MasterPage. The MasterPage actually contains the <form> tag which is used throughout the site. On just certain pages that use that MasterPage, I need the "enctype" for the enctype = "multipart / form-data" On the rest of the pages, I do not need this. How can my specific ASPX page that uses the MasterPage change the MasterPage's <form enctype = . . .> just for that page? Or is there a better way? Alex ASP.NET Discussions EventArgs (1) TestContentPage (1) Init (1) MasterPage (1) Online (1) Maghen (1) Sergey (1) Alex (1) just set it in code behind AS IS" with no warranties, and confers no rights. keywords: enctype = "multipart / form-data", for, MasterPage description: I have a MasterPage. The MasterPage actually contains the form tag which is used