Links In Master Pages

Last post 05-09-2008 2:12 AM by Amanda Wang - MSFT. 2 replies.

Sort Posts:

  • Links In Master Pages

    05-07-2008, 4:17 PM
    • Loading...
    • md123
    • Joined on 05-07-2008, 8:05 PM
    • Posts 7

    Hi,

    Got a problem with links in my master pages. I have my file structure set out as below:

     Root Folder

         MembersArea

                     Admin

    I have a Master Page in the MembersArea folder which provides me with buttons for accessing some pages in the Admin folder, which are available only to the users with admin accounts, when I link into a page in there then click a link to go to a page outside of the folder I get an error, as the link expects that page to be in the Admin folder. These pages do load if I dont access a page in the Admin folder first.

    Here is the line from my master page where I defined my links:

    <div id="mainmenu"><ul> <li><a href="AddRecords.aspx">Add Quotes</a></li> <li><a href="Admin/ViewQuote.aspx">View Quote</a></li><li><a href="Admin/Upload.aspx">Upload New Products</a></li><li><a href="NewProducts.aspx">New Products</a></li></ul></div>

     I have tried changing my HRef to read "../AddRecords.aspx" but then ofcourse the link will nto load intially as the path then becomes invalid, if I put the full path being "~/MembersArea/AddRecords.aspx" I get an error as the path becomes "~MembersArea/~/MembersArea/AddRecords.aspx" which is because I assume it knows that the page AddRecords is in the MembersArea folder.

    Could anyone let me know what I need to do to my links in order to enable me to link into and exit pages between two folders, from the one master page easily?

    Sorry if anything does not display correctly, first post on here, if more info is needed I will post what I can, not ASP.NET savvy this is my first website using it.

    Using Microsoft Visual Web Developer 2008 Express Edition, incase that makes a difference to the answer/steps to take.

     Very Much Appreciated

     

     

  • Re: Links In Master Pages

    05-07-2008, 6:40 PM
    • Loading...
    • RideSearch
    • Joined on 05-07-2008, 10:21 PM
    • Posts 2

    I would usp <asp:linkbutton> and then for the onclick event I would locate the place to open depending on the server location. That is if you need to need to do server side work. You could then use response.redirect to the url or server.transfer depening on what you want to do. You could also have the href back out to the root directory and then find the path from there.

     

    Brian

    Carpool for a better tomorrow with RideSearch.com

     

  • Re: Links In Master Pages

    05-09-2008, 2:12 AM

    Hi,

    md123:
     I have tried changing my HRef to read "../AddRecords.aspx" but then ofcourse the link will nto load intially as the path then becomes invalid, if I put the full path being "~/MembersArea/AddRecords.aspx" I get an error as the path becomes "~MembersArea/~/MembersArea/AddRecords.aspx" which is because I assume it knows that the page AddRecords is in the MembersArea folder.

    If you use full path""~/MembersArea/AddRecords.aspx" , you can try to set the link's runat is server,  because "~" represents the root directory and only on the server side.

    Hope it helps.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Yours sincerely,
    Amanda Wang
    Microsoft Online Community Support
Page 1 of 1 (3 items)