Refering to a master page from a directory

Discussion in 'ASP .Net' started by JJ, Jul 4, 2006.

  1. JJ

    JJ Guest

    My master page contains various graphics that are referenced from the images
    folder. As long as the container pages are at the same level (ie. the top
    level looking at the solution explorer in Visual studio 2005) as the master
    page, the images appear correctly.

    However, the images do not appear when I am using a container file within a
    directory.

    Do I need to use links that aren't relative to the master page so that any
    content page in any directory can use the same master.

    Can anyone help me....?

    JJ
     
    JJ, Jul 4, 2006
    #1
    1. Advertising

  2. Use a css file to specify the graphics. Then the url of the images are
    expressed relative to the css file, not relative to the page.

    If you create a theme and put the css file in the theme folder, you can
    just set the Theme property of the page and it will add a link with a
    correct address to the css file regardless of where the page is.

    JJ wrote:
    > My master page contains various graphics that are referenced from the images
    > folder. As long as the container pages are at the same level (ie. the top
    > level looking at the solution explorer in Visual studio 2005) as the master
    > page, the images appear correctly.
    >
    > However, the images do not appear when I am using a container file within a
    > directory.
    >
    > Do I need to use links that aren't relative to the master page so that any
    > content page in any directory can use the same master.
    >
    > Can anyone help me....?
    >
    > JJ
    >
    >
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jul 4, 2006
    #2
    1. Advertising

  3. JJ

    JJ Guest

    Thanks. I declared a new class in my css file called '.main_graphic'. When
    I built the class through the Visual Studio wizard however, the link to the
    image was wrong:
    Visual Studio put this:
    img/main_graphic.jpg

    When in fact it only works if it is this:
    .../../img/main_graphic.jpg

    as the css file is in the 'Theme1' folder which is in the 'App_Themes'
    folder. Either thats a bug or I am doing something wrong??? Am I supposed to
    store all images in the Theme folder?



    I also assume that you have to set the 'background image 'of the class in
    order to have a graphic, so that class looks like this:
    ..main_graphic

    {

    background-image: url(../../img/main_graphic.jpg);

    background-repeat: no-repeat;

    }

    Is this the corect approach??

    Thanks

    JJ



    "Göran Andersson" <> wrote in message
    news:...
    > Use a css file to specify the graphics. Then the url of the images are
    > expressed relative to the css file, not relative to the page.
    >
    > If you create a theme and put the css file in the theme folder, you can
    > just set the Theme property of the page and it will add a link with a
    > correct address to the css file regardless of where the page is.
    >
    > JJ wrote:
    >> My master page contains various graphics that are referenced from the
    >> images folder. As long as the container pages are at the same level (ie.
    >> the top level looking at the solution explorer in Visual studio 2005) as
    >> the master page, the images appear correctly.
    >>
    >> However, the images do not appear when I am using a container file within
    >> a directory.
    >>
    >> Do I need to use links that aren't relative to the master page so that
    >> any content page in any directory can use the same master.
    >>
    >> Can anyone help me....?
    >>
    >> JJ
     
    JJ, Jul 5, 2006
    #3
  4. I have never used that wizard in Visual studio 2003/2005, so I can't say
    anything about it.

    You can put your images in the theme folder if you like, but there is no
    need to.

    Yes, that css looks correct.

    JJ wrote:
    > Thanks. I declared a new class in my css file called '.main_graphic'. When
    > I built the class through the Visual Studio wizard however, the link to the
    > image was wrong:
    > Visual Studio put this:
    > img/main_graphic.jpg
    >
    > When in fact it only works if it is this:
    > ../../img/main_graphic.jpg
    >
    > as the css file is in the 'Theme1' folder which is in the 'App_Themes'
    > folder. Either thats a bug or I am doing something wrong??? Am I supposed to
    > store all images in the Theme folder?
    >
    >
    >
    > I also assume that you have to set the 'background image 'of the class in
    > order to have a graphic, so that class looks like this:
    > .main_graphic
    >
    > {
    >
    > background-image: url(../../img/main_graphic.jpg);
    >
    > background-repeat: no-repeat;
    >
    > }
    >
    > Is this the corect approach??
    >
    > Thanks
    >
    > JJ
    >
    >
    >
    > "Göran Andersson" <> wrote in message
    > news:...
    >> Use a css file to specify the graphics. Then the url of the images are
    >> expressed relative to the css file, not relative to the page.
    >>
    >> If you create a theme and put the css file in the theme folder, you can
    >> just set the Theme property of the page and it will add a link with a
    >> correct address to the css file regardless of where the page is.
    >>
    >> JJ wrote:
    >>> My master page contains various graphics that are referenced from the
    >>> images folder. As long as the container pages are at the same level (ie.
    >>> the top level looking at the solution explorer in Visual studio 2005) as
    >>> the master page, the images appear correctly.
    >>>
    >>> However, the images do not appear when I am using a container file within
    >>> a directory.
    >>>
    >>> Do I need to use links that aren't relative to the master page so that
    >>> any content page in any directory can use the same master.
    >>>
    >>> Can anyone help me....?
    >>>
    >>> JJ

    >
    >
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jul 5, 2006
    #4
  5. JJ

    JJ Guest

    Thanks.

    "Göran Andersson" <> wrote in message
    news:...
    >I have never used that wizard in Visual studio 2003/2005, so I can't say
    >anything about it.
    >
    > You can put your images in the theme folder if you like, but there is no
    > need to.
    >
    > Yes, that css looks correct.
    >
    > JJ wrote:
    >> Thanks. I declared a new class in my css file called '.main_graphic'.
    >> When I built the class through the Visual Studio wizard however, the link
    >> to the
    >> image was wrong:
    >> Visual Studio put this:
    >> img/main_graphic.jpg
    >>
    >> When in fact it only works if it is this:
    >> ../../img/main_graphic.jpg
    >>
    >> as the css file is in the 'Theme1' folder which is in the 'App_Themes'
    >> folder. Either thats a bug or I am doing something wrong??? Am I supposed
    >> to store all images in the Theme folder?
    >>
    >>
    >>
    >> I also assume that you have to set the 'background image 'of the class in
    >> order to have a graphic, so that class looks like this:
    >> .main_graphic
    >>
    >> {
    >>
    >> background-image: url(../../img/main_graphic.jpg);
    >>
    >> background-repeat: no-repeat;
    >>
    >> }
    >>
    >> Is this the corect approach??
    >>
    >> Thanks
    >>
    >> JJ
    >>
    >>
    >>
    >> "Göran Andersson" <> wrote in message
    >> news:...
    >>> Use a css file to specify the graphics. Then the url of the images are
    >>> expressed relative to the css file, not relative to the page.
    >>>
    >>> If you create a theme and put the css file in the theme folder, you can
    >>> just set the Theme property of the page and it will add a link with a
    >>> correct address to the css file regardless of where the page is.
    >>>
    >>> JJ wrote:
    >>>> My master page contains various graphics that are referenced from the
    >>>> images folder. As long as the container pages are at the same level
    >>>> (ie. the top level looking at the solution explorer in Visual studio
    >>>> 2005) as the master page, the images appear correctly.
    >>>>
    >>>> However, the images do not appear when I am using a container file
    >>>> within a directory.
    >>>>
    >>>> Do I need to use links that aren't relative to the master page so that
    >>>> any content page in any directory can use the same master.
    >>>>
    >>>> Can anyone help me....?
    >>>>
    >>>> JJ

    >>
     
    JJ, Jul 5, 2006
    #5
    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. =?Utf-8?B?TmljayBaZHVuaWM=?=

    Refering to web page class from another class

    =?Utf-8?B?TmljayBaZHVuaWM=?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    437
    Karl Seguin [MVP]
    Feb 8, 2006
  2. =?Utf-8?B?TmljayBaZHVuaWM=?=

    ASP.Net 2.0 - refering to the web page class

    =?Utf-8?B?TmljayBaZHVuaWM=?=, Feb 9, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,445
  3. Doug McCann
    Replies:
    1
    Views:
    1,037
    William Brogden
    Aug 5, 2004
  4. TRalia

    Refering to a control on a page shown in a frameset

    TRalia, Jan 21, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    142
    TRalia
    Jan 21, 2004
  5. Replies:
    11
    Views:
    266
    Cédric Finance
    Nov 8, 2007
Loading...

Share This Page