User Controls and Image Sources

Discussion in 'ASP .Net Web Controls' started by John, Aug 5, 2004.

  1. John

    John Guest

    I am pulling my hair out regarding how the source URL
    should be for images, javascript, etc. when including
    user controls in my aspx pages. I am developing sites on
    my local machine (XP Pro, IIS 5.0) and can't seem to get
    my user controls to appear correctly. All my images are
    broken and I get javascript errors because it can't find
    the file. This is all due to how I am defining the
    source (I believe).

    Since my user controls can be used at different levels
    within my app, I define the source as
    src="/images/image.gif">. The same applies to my
    javascript - src="/js/tabpane.js". What I think is
    happening is it is looking for these files at the root of
    my wwwroot folder. I am using VS.NET 2003 to develop my
    sites. Can anyone help me out? Is there a better way
    of organizing/setting up my site structure?
    John, Aug 5, 2004
    #1
    1. Advertising

  2. John

    Juno Guest

    Hi,

    I think you'd better use relative path rather than absolute path. For
    example: <img src="../images/image.gif">.


    Juno
    MCSD.NET, MCDBA, MCSE
    ----------------------------------------------------------
    Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
    DataForm.NET - The most powerful data entry web server control for ASP.NET



    "John" <> wrote in message
    news:085201c47af3$0b63fbc0$...
    > I am pulling my hair out regarding how the source URL
    > should be for images, javascript, etc. when including
    > user controls in my aspx pages. I am developing sites on
    > my local machine (XP Pro, IIS 5.0) and can't seem to get
    > my user controls to appear correctly. All my images are
    > broken and I get javascript errors because it can't find
    > the file. This is all due to how I am defining the
    > source (I believe).
    >
    > Since my user controls can be used at different levels
    > within my app, I define the source as
    > src="/images/image.gif">. The same applies to my
    > javascript - src="/js/tabpane.js". What I think is
    > happening is it is looking for these files at the root of
    > my wwwroot folder. I am using VS.NET 2003 to develop my
    > sites. Can anyone help me out? Is there a better way
    > of organizing/setting up my site structure?
    Juno, Aug 5, 2004
    #2
    1. Advertising

  3. John

    John Guest

    I don't think I would be able to do that if the controls
    were used in any sub folders, right?
    >-----Original Message-----
    >Hi,
    >
    >I think you'd better use relative path rather than

    absolute path. For
    >example: <img src="../images/image.gif">.
    >
    >
    >Juno
    >MCSD.NET, MCDBA, MCSE
    >---------------------------------------------------------

    -
    >Support Team of EasyDotNet, INC.

    http://www.EasyDotNet.com
    >DataForm.NET - The most powerful data entry web server

    control for ASP.NET
    >
    >
    >
    >"John" <> wrote in

    message
    >news:085201c47af3$0b63fbc0$...
    >> I am pulling my hair out regarding how the source URL
    >> should be for images, javascript, etc. when including
    >> user controls in my aspx pages. I am developing sites

    on
    >> my local machine (XP Pro, IIS 5.0) and can't seem to

    get
    >> my user controls to appear correctly. All my images

    are
    >> broken and I get javascript errors because it can't

    find
    >> the file. This is all due to how I am defining the
    >> source (I believe).
    >>
    >> Since my user controls can be used at different levels
    >> within my app, I define the source as
    >> src="/images/image.gif">. The same applies to my
    >> javascript - src="/js/tabpane.js". What I think is
    >> happening is it is looking for these files at the root

    of
    >> my wwwroot folder. I am using VS.NET 2003 to develop

    my
    >> sites. Can anyone help me out? Is there a better way
    >> of organizing/setting up my site structure?

    >
    >
    >.
    >
    John, Aug 5, 2004
    #3
    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. Michael David Pedersen
    Replies:
    2
    Views:
    3,587
    Michael David Pedersen
    Jul 22, 2004
  2. Replies:
    1
    Views:
    537
    jrudy
    Sep 25, 2006
  3. voncroy14
    Replies:
    0
    Views:
    1,053
    voncroy14
    Jul 17, 2009
  4. Faizan Ahmed
    Replies:
    1
    Views:
    283
    John Saunders
    Jan 4, 2005
  5. Dave

    sources for 3rd party controls?

    Dave, Sep 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    134
Loading...

Share This Page