使用〜(虚拟路径)与图像 [英] using ~ (virtual path) with images

查看:75
本文介绍了使用〜(虚拟路径)与图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net中创建了一个标题控件,它引用了virtural path的根文件夹中/ images /

文件夹中的图像...如何获取标题

控制在网站的任何级别显示图像?我得到了控件

加载使用〜/ tempates / ctrlHeader的东西在

的参考部分使用它们的页面,但我在实际需要同样的想法控制所以

它知道参考图像文件夹没有主页它所做的页面

来自网站...我怎么能这样做?有没有办法在img src中使用

~?谢谢


这个结构的例子


/ root

| ---图片

| ---标题等控件......

| - main page.html

| ---文件夹中的新页面

| ---子页面1 ..引用控制头和img

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>在消息中写道

news:%2 ****************** @ TK2MSFTNGP10.phx.gbl ...
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
我在asp.net中创建了一个标题控件,它在virtural path的根文件夹中的
/ images /文件夹中引用图像...如何获得标题
控件来显示图像在网站的任何级别?我在使用它们的页面的引用部分中使用〜/ tempates / ctrlHeader来加载
控件,但我在实际控件中需要相同的想法
所以它知道引用图像文件夹无论在哪里,它所做的页面位于网站中......我怎么能这样做?有没有办法在img src中使用
~?谢谢

这个例子的结构

/ root
| ---图片
| ---标题等控件......
| - 主页面页面
| ---文件夹中的新页面
| ---子页面1 ..引用控件头和img
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




也许你应该举例说明你在谈论什么。

-

John Saunders

SurfControl.com的John.Saunders



Perhaps you should give an example of what you''re talking about.
--
John Saunders
John.Saunders at SurfControl.com


"布莱恩亨利 < brian.henry [NOSPAM] @ adelphia.net>在消息中写道

news:%2 ****************** @ TK2MSFTNGP10.phx.gbl ...
"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
我在asp.net中创建了一个标题控件,它在virtural path的根文件夹中的
/ images /文件夹中引用图像...如何获得标题
控件来显示图像在网站的任何级别?我在使用它们的页面的引用部分中使用〜/ tempates / ctrlHeader来加载
控件,但我在实际控件中需要相同的想法
所以它知道引用图像文件夹无论在哪里,它所做的页面位于网站中......我怎么能这样做?有没有办法在img src中使用
~?谢谢

这个例子的结构

/ root
| ---图片
| ---标题等控件......
| - 主页面页面
| ---文件夹中的新页面
| ---子页面1 ..引用控件头和img
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




也许你应该举例说明你在谈论什么。

-

John Saunders

SurfControl.com的John.Saunders



Perhaps you should give an example of what you''re talking about.
--
John Saunders
John.Saunders at SurfControl.com


如果我理解你的情况,如果你确定

< img>标签在服务器上运行,然后使用〜表示法转到

图像子目录,


例如< img src ="〜/ images / pic.jpg" runat = server>


HTH,

Pete Beech


" Brian Henry" < brian.henry [NOSPAM] @ adelphia.net>在消息中写道

news:%2 ****************** @ TK2MSFTNGP10.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...
我在asp.net中创建了一个标题控件,它在virtural path的根文件夹中的
/ images /文件夹中引用图像...如何获得标题
控件来显示图像在网站的任何级别?我在使用它们的页面的引用部分中使用〜/ tempates / ctrlHeader来加载
控件,但我在实际控件中需要相同的想法
所以它知道引用图像文件夹无论在哪里,它所做的页面位于网站中......我怎么能这样做?有没有办法在img src中使用
~?谢谢

这个例子的结构

/ root
| ---图片
| ---标题等控件......
| - 主页面页面
| ---文件夹中的新页面
| ---子页面1 ..引用控件头和img
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



这篇关于使用〜(虚拟路径)与图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆