Image In User Control

R

RN1

A user control has an image & a few Labels. When I view the ASPX page
that uses this user control in my local machine, the image can be seen
but when I upload the ASPX page & the ASCX page to my remote server,
the ASPX page shows the Labels but it doesn't show the image.
Strangely the source code of the ASPX page includes the image code.

What could the problem be?

Thanks,

Ron
 
R

RN1

Hi,

Check the source of the image...
a relative url will work okay in every case if you have the image in
your project...
perhaps you are working with absolute URL...

 Best of luck

When the image wasn't getting rendered, I was using

<table background="\Images\Stars.gif">

When I changed it to

<table background="Images\Stars.gif">

the image gets rendered. Why so?

Thanks,

Ron
 
M

michel.desangles

When the image wasn't getting rendered, I was using

<table background="\Images\Stars.gif">

When I changed it to

<table background="Images\Stars.gif">

the image gets rendered. Why so?

Thanks,

Ron

If you prefix your path with a \, you indicate that the path is
relative to the site's root. If the path is relative to the page,
don't use the first \. For instance, if your site has this structure :

Default.aspx
SomeFolder/
SomeFolder/MyPage.aspx
SomeFolder/Pics/
SomeFolder/Pics/mypic.gif

...and your table is in the "MyPage.aspx", specifying this path for
the image :

\Pics\mypic.gif

...would look for a "Pics" folder at the root of the site. As there
isn't one, nothing happens. Whereas this:

Pics\mypic.gif

...would look for a "Pics" folder at the same level as the containg
page, that is, inside "SomeFolder".

(also, as you're dealing with Urls and not the filesystem, you should
use forward slashes instead of backslashes. The framework translates
for you, but it's just a good habit to have).

Michel
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top