Master Pages and content pages in subfolder

Discussion in 'ASP .Net' started by vikramp, Oct 13, 2006.

  1. vikramp

    vikramp Guest

    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.
    vikramp, Oct 13, 2006
    #1
    1. Advertising

  2. vikramp

    Mark Rae Guest

    "vikramp" <> wrote in message
    news:...

    > 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
    Mark Rae, Oct 13, 2006
    #2
    1. Advertising

  3. vikramp

    apathetic Guest

    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" />
    apathetic, Oct 13, 2006
    #3
  4. vikramp

    vikramp Guest

    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" />
    vikramp, Oct 13, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug McCann
    Replies:
    1
    Views:
    1,000
    William Brogden
    Aug 5, 2004
  2. Replies:
    1
    Views:
    3,197
    PeterKellner
    May 16, 2006
  3. Replies:
    0
    Views:
    717
  4. jobs
    Replies:
    1
    Views:
    458
    clintonG
    Dec 13, 2006
  5. sjsean

    master pages and content pages

    sjsean, Aug 1, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    450
    Scott M.
    Aug 1, 2009
Loading...

Share This Page