I made a header control in asp.net and it references images in the /images/
folder in the virtural path's root folder... How can I get the header
control to show the images at any level of the web site? i got the controls
to load using the ~/tempates/ctrlHeader thing in the references section of
the page that uses them, but I need that same idea in the actual control so
it knows to refrence the image folder no mater where the page its doing it
from is located in the site... how can i do this? is there a way to use the
~ in the img src? thanks
example structure of this
/ root
|--- images
|--- controls for header etc...
| -- main page.html
|--- new pages in folder
| --- sub page 1.. references control header and img 12 1731
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the
/images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the
controls to load using the ~/tempates/ctrlHeader thing in the references section of the page that uses them, but I need that same idea in the actual control
so it knows to refrence the image folder no mater where the page its doing it from is located in the site... how can i do this? is there a way to use
the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
Perhaps you should give an example of what you're talking about.
--
John Saunders
John.Saunders at SurfControl.com
If I understand your situation right, it should work if you make sure the
<img> tag runs on the server, and then use the ~ notation to get to the
images subdir,
e.g. <img src="~/images/pic.jpg" runat=server>
HTH,
Pete Beech
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the
/images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the
controls to load using the ~/tempates/ctrlHeader thing in the references section of the page that uses them, but I need that same idea in the actual control
so it knows to refrence the image folder no mater where the page its doing it from is located in the site... how can i do this? is there a way to use
the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
Hi Brian,
The ~ syntax works with ASP.Net controls etc. but if you build your own URLs
this obviously won't work.
Take a look at this BLOG entry: http://west-wind.com/weblog/posts/269.aspx
which talks about the various ASP.Net paths and also provides a generic
routine that lets you properly expand your own Urls using the ~ syntax.
Regards,
+++ Rick ---
--
Rick Strahl
West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:#7**************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the
/images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the
controls to load using the ~/tempates/ctrlHeader thing in the references section of the page that uses them, but I need that same idea in the actual control
so it knows to refrence the image folder no mater where the page its doing it from is located in the site... how can i do this? is there a way to use
the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
thanks! that works great for img tag's.. is there anyway to also do this
with backgrounds of tables? runat=server doesnt seem to work on td tags with
background = "~/images/img.gif"
thanks!
"Pete Beech" <pe*********@hotmail.nojunk.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl... If I understand your situation right, it should work if you make sure the <img> tag runs on the server, and then use the ~ notation to get to the images subdir,
e.g. <img src="~/images/pic.jpg" runat=server>
HTH, Pete Beech
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the /images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the controls to load using the ~/tempates/ctrlHeader thing in the references section
of the page that uses them, but I need that same idea in the actual control so it knows to refrence the image folder no mater where the page its doing
it from is located in the site... how can i do this? is there a way to use the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
Hey Brian,
Don't forget the ASP.NET Table control...
<asp:Table id="Table1" runat="server" BorderWidth=1
BackImageUrl="~/images/floor.jpg">
<asp:TableRow>
<asp:TableCell>Hello</asp:TableCell>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
<asp:TableRow></asp:TableRow>
<asp:TableRow></asp:TableRow>
</asp:Table>
Ken
Microsoft MVP [ASP.NET]
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... thanks! that works great for img tag's.. is there anyway to also do this with backgrounds of tables? runat=server doesnt seem to work on td tags with background = "~/images/img.gif"
thanks!
"Pete Beech" <pe*********@hotmail.nojunk.com> wrote in message news:OZ**************@TK2MSFTNGP09.phx.gbl... If I understand your situation right, it should work if you make sure the <img> tag runs on the server, and then use the ~ notation to get to the images subdir,
e.g. <img src="~/images/pic.jpg" runat=server>
HTH, Pete Beech
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... > I made a header control in asp.net and it references images in the /images/ > folder in the virtural path's root folder... How can I get the header > control to show the images at any level of the web site? i got the controls > to load using the ~/tempates/ctrlHeader thing in the references section of > the page that uses them, but I need that same idea in the actual > control so > it knows to refrence the image folder no mater where the page its doing it > from is located in the site... how can i do this? is there a way to use the > ~ in the img src? thanks > > example structure of this > > / root > |--- images > |--- controls for header etc... > | -- main page.html > |--- new pages in folder > | --- sub page 1.. references control header and img > >
No, Brian, it won't work with tables. You can do something like this...
<table background='<%=ResolveUrl("~/images/image.jpg")%>'>
.... rest of table goes here
HTH
Brian W
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... thanks! that works great for img tag's.. is there anyway to also do this with backgrounds of tables? runat=server doesnt seem to work on td tags
with background = "~/images/img.gif"
thanks!
"Pete Beech" <pe*********@hotmail.nojunk.com> wrote in message news:OZ**************@TK2MSFTNGP09.phx.gbl... If I understand your situation right, it should work if you make sure
the <img> tag runs on the server, and then use the ~ notation to get to the images subdir,
e.g. <img src="~/images/pic.jpg" runat=server>
HTH, Pete Beech
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the /images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the controls to load using the ~/tempates/ctrlHeader thing in the references
section of the page that uses them, but I need that same idea in the actual
control so it knows to refrence the image folder no mater where the page its
doing it from is located in the site... how can i do this? is there a way to
use the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
thanks, all your comments helped a lot
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl... No, Brian, it won't work with tables. You can do something like this...
<table background='<%=ResolveUrl("~/images/image.jpg")%>'> ... rest of table goes here
HTH Brian W
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... thanks! that works great for img tag's.. is there anyway to also do this with backgrounds of tables? runat=server doesnt seem to work on td tags with background = "~/images/img.gif"
thanks!
"Pete Beech" <pe*********@hotmail.nojunk.com> wrote in message news:OZ**************@TK2MSFTNGP09.phx.gbl... If I understand your situation right, it should work if you make sure the <img> tag runs on the server, and then use the ~ notation to get to
the images subdir,
e.g. <img src="~/images/pic.jpg" runat=server>
HTH, Pete Beech
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl... > I made a header control in asp.net and it references images in the /images/ > folder in the virtural path's root folder... How can I get the
header > control to show the images at any level of the web site? i got the controls > to load using the ~/tempates/ctrlHeader thing in the references section of > the page that uses them, but I need that same idea in the actual control so > it knows to refrence the image folder no mater where the page its doing it > from is located in the site... how can i do this? is there a way to use the > ~ in the img src? thanks > > example structure of this > > / root > |--- images > |--- controls for header etc... > | -- main page.html > |--- new pages in folder > | --- sub page 1.. references control header and img > >
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the
/images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the
controls to load using the ~/tempates/ctrlHeader thing in the references section of the page that uses them, but I need that same idea in the actual control
so it knows to refrence the image folder no mater where the page its doing it from is located in the site... how can i do this? is there a way to use
the ~ in the img src? thanks
Yes. Add the attribute runat="server" to the <img> tag.
Of course, this will only work in .aspx files, not in .htm or .html files.
--
Jos
Hi Rick,
I had a quick look at your blog entry - I think ResolveURL will do the same
as your function, with regard to ~'s at the start of the URL.
Pete
"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP10.phx.gbl... Hi Brian,
The ~ syntax works with ASP.Net controls etc. but if you build your own
URLs this obviously won't work.
Take a look at this BLOG entry:
http://west-wind.com/weblog/posts/269.aspx
which talks about the various ASP.Net paths and also provides a generic routine that lets you properly expand your own Urls using the ~ syntax.
Regards,
+++ Rick ---
--
Rick Strahl West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/weblog/ ---------------------------------- Making waves on the Web
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message news:#7**************@TK2MSFTNGP10.phx.gbl... I made a header control in asp.net and it references images in the /images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the controls to load using the ~/tempates/ctrlHeader thing in the references section
of the page that uses them, but I need that same idea in the actual control so it knows to refrence the image folder no mater where the page its doing
it from is located in the site... how can i do this? is there a way to use the ~ in the img src? thanks
example structure of this
/ root |--- images |--- controls for header etc... | -- main page.html |--- new pages in folder | --- sub page 1.. references control header and img
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl... No, Brian, it won't work with tables. You can do something like this...
<table background='<%=ResolveUrl("~/images/image.jpg")%>'> ... rest of table goes here
Why wouldn't the following work:
<table runat="server" background="~/images/image.jpg">
....
</table>
--
John Saunders
John.Saunders at SurfControl.com
Why should it.
It works only in a handful amount of methods.
If some processing of the path is required then it works. If it's just a
property you set then it does not.
George.
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl... "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message news:eN**************@TK2MSFTNGP09.phx.gbl... No, Brian, it won't work with tables. You can do something like this...
<table background='<%=ResolveUrl("~/images/image.jpg")%>'> ... rest of table goes here
Why wouldn't the following work:
<table runat="server" background="~/images/image.jpg"> ... </table> -- John Saunders John.Saunders at SurfControl.com
Actually, it has to do with how the HTML server control was implemented.
Whoever wrote the code for System.Web.UI.HtmlControls.HtmlTable chose not to
resolve the path before rendering.
Regards
Brian W
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl... "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message news:eN**************@TK2MSFTNGP09.phx.gbl... No, Brian, it won't work with tables. You can do something like this...
<table background='<%=ResolveUrl("~/images/image.jpg")%>'> ... rest of table goes here
Why wouldn't the following work:
<table runat="server" background="~/images/image.jpg"> ... </table> -- John Saunders John.Saunders at SurfControl.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian Henry |
last post by:
I made a header control in asp.net and it references images in the /images/
folder in the virtural path's root folder... How can I get the header
control to show the images at any level of the web...
|
by: Ibrahim |
last post by:
I have made an Aplication use VPP and make deploy for it on IIS on
windows 2003 Server
1- built the web Application with Asp.net2
2- Implement the Virtual path provider (Virtual path , virtual...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |