8.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:189838
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
This is exactly the problem
When placing an image control on a UserControl the path assigned to the
image will be relative to the user control which is not necessarily the same
as the webform the user control is placed on.
Take the following example:
I have a folder/structure like this
root \+
Default.aspx
+- images\
mypicture.jpg
+- controls
myheader.ascx
+- help\
about.aspx
if I place an image control on myheader.ascx and use the designer to assign
the image, the designer assigns ../images/mypicture.jpg to the ImageUrl
attribute.
When I place myheader.ascx on Default.aspx (which reside in the root) and
run the app the link to mypicture.jpg is broken because
../images/mypicture.jpg is not the correct relative path in the context of
Default.aspx.
Now, if I place myheader.ascx on about.aspx (residing in help directory) the
link is un-broken because the relative path for about.aspc is correct.
Clear as mud, right?!?! ;-)
I actually brought this very topic up several months ago in this or the IDE
NG.
Brian W
Marty,
I'm a bit confused. The URL to the image will have to be relative to the
Webform onto which your user control is placed. If not, the image link
will be broken.
Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)
This post is provided as-is with no warranties and confers no rights.
--------------------
Content-Class: urn:content-classes:message
From: "Marty" <
[email protected]>
Sender: "Marty" <
[email protected]>
Subject: Driving me nuts...
Date: Mon, 10 Nov 2003 11:07:37 -0800
Lines: 6
Message-ID: <
[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcOnvefxXWxzEBR1RRmi3tV9aszCgw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:189810
NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
It seems all of the sudden that user controls that
contain images are referencing image sources relative to
the document that I drop the control on. This obviously
does not work beacuase the image source is relative to
the user control, not necessarily the form. Can anyone
tell me why this would be the case?