Image In User Control

Discussion in 'ASP .Net' started by RN1, Aug 7, 2008.

  1. RN1

    RN1 Guest

    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
    RN1, Aug 7, 2008
    #1
    1. Advertising

  2. RN1

    Munna Guest

    Munna, Aug 7, 2008
    #2
    1. Advertising

  3. RN1

    RN1 Guest

    On Aug 7, 11:15 am, Munna <> wrote:
    > 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
    >
    > -------
    > Munna
    >
    > www.munna.shatkotha.com/blogwww.munna.shatkotha.comwww.shatkotha.com


    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
    RN1, Aug 7, 2008
    #3
  4. RN1

    Guest

    On 7 août, 09:27, RN1 <> wrote:
    > On Aug 7, 11:15 am, Munna <> wrote:
    >
    > > 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

    >
    > > -------
    > > Munna

    >
    > >www.munna.shatkotha.com/blogwww.munna.shatkotha.comwww.shatkotha.com

    >
    > 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
    , Aug 7, 2008
    #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. Tom Rowton
    Replies:
    2
    Views:
    645
    Tom Rowton
    Aug 1, 2003
  2. SamIAm
    Replies:
    1
    Views:
    568
    Jerry III
    Oct 17, 2003
  3. vatech1993
    Replies:
    4
    Views:
    5,675
    =?Utf-8?B?U8Opcmdpbw==?=
    Dec 11, 2004
  4. Mad Scientist Jr
    Replies:
    0
    Views:
    626
    Mad Scientist Jr
    Mar 22, 2006
  5. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    530
    Jonathan Wood
    Feb 2, 2010
Loading...

Share This Page