Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2009, 10:05 AM
Authorized User
 
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default Problem loading graphics with master page

Hello guys,
I just notice than when I create a new web form in a different path from master.page, it does not display some of the graphics.
Could anyone advice me?
Thank you in advanced
 
Old January 18th, 2009, 10:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

How are you referencing the images? If they are server side images, you can reference them like this:

<img src="~/Images/SomeImage.jpg" alt="SomeText" id="Logo" Runat="Server" />

~/ always refers to the root of the application, so it works regardless the location of the master page.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 18th, 2009, 10:24 AM
Authorized User
 
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

in my case i use <table cellspacing="0"

style="background-repeat: no-repeat; width: 901px; height: 493px; background-image: url('Pics/Main_Backroung.jpg');">

i tried what you just told me and it does not appear the image at all.
 
Old January 18th, 2009, 10:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
i tried what you just told me and it does not appear the image at all.
Quote:
If they are server side images, you can reference them like this:
This only works with server side paths as the ~ is an ASP.NET thing.

In your case, try referencing the root, assuming Pics is in the root:

<table cellspacing="0" style="background-repeat: no-repeat; width: 901px; height: 493px; background-image: url('/Pics/Main_Backroung.jpg');">

Note the / before the folder Pics.

Alternatively, move the CSS to a separate CSS file. If you store it in a folder at the same level as Pics (like /Css), you can refer to the images like this:

.MyTable
{
background-repeat: no-repeat;
width: 901px;
height: 493px;
background-image: url('../Pics/Main_Backroung.jpg');
}

You then need to set a class on the table like this:

<table cellspacing="0" class="MyTable">

By moving the CSS to a separate file, it's easy to refer to images from that file, as the images are searched for relative to the .CSS file; not relative to the ASPX file (or Master Page) that uses them.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
problem with master page rendering in ch02 MM BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 December 5th, 2006 08:22 PM
how inserting more bitmap graphics in a page? hertendreef ASP.NET 2.0 Professional 0 December 5th, 2006 10:22 AM
Session Not available Problem in Master Page cbe_seenu ASP.NET 2.0 Professional 0 July 31st, 2006 08:47 AM
Page Loading Problem devteam SQL Server 2000 1 January 9th, 2006 12:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.