Why am I getting this error?

M

ma

Hello,

I have a page with a image button. I defined it as follow:

<asp:ImageButton ID="ImageButton" runat="server"
ImageUrl="images\myimage.bmp" OnClick="Button_Click" Visible="False" />

the error list pane, shows this error:

File image\myimage.bmp was not found. But when I am compiling the
application, it works correctly (can see the image button and the image on
it.)

What is the problem and how can I solve it?

Where is the best place to put images and other resources for a web
application? How to use them in an application. Any reference material on
this?

Regards
 
M

Michael Nemtsev, MVP

Hello ma,

VS just cant resolve the path. use the intellisence dialog to pick the url
after u typed ImageUrl="
I suppose if u specify the relative path like "~\images\myimage.bmp" everything
will be ok

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


m> Hello,
m>
m> I have a page with a image button. I defined it as follow:
m>
m> <asp:ImageButton ID="ImageButton" runat="server"
m> ImageUrl="images\myimage.bmp" OnClick="Button_Click" Visible="False"
m> />
m>
m> the error list pane, shows this error:
m>
m> File image\myimage.bmp was not found. But when I am compiling the
m> application, it works correctly (can see the image button and the
m> image on it.)
m>
m> What is the problem and how can I solve it?
m>
m> Where is the best place to put images and other resources for a web
m> application? How to use them in an application. Any reference
m> material on this?
m>
m> Regards
m>
 
M

ma

Thanks,
The "~\image\myimage.bmp" did not make any difference.

I tried to use intellisence without any sucess. When I am using
intellisence, it shows nothing under image directory eventhought that there
are some images there.

Any suggestion?

Regartds
 
P

Patrice

What if you try / instead of \ ? An URL is suppoped to use / rather than \
and it could perhaps confuse visual studio verification. You could also just
use the properties window and pick the file to see how is is then
referenced.

---
Patrice

ma said:
Thanks,
The "~\image\myimage.bmp" did not make any difference.

I tried to use intellisence without any sucess. When I am using
intellisence, it shows nothing under image directory eventhought that
there are some images there.

Any suggestion?

Regartds


Hello ma,

VS just cant resolve the path. use the intellisence dialog to pick the
url after u typed ImageUrl="
I suppose if u specify the relative path like "~\images\myimage.bmp"
everything will be ok

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and
we miss it, but that it is too low and we reach it" (c) Michelangelo

m> Hello,
m> m> I have a page with a image button. I defined it as follow:
m> m> <asp:ImageButton ID="ImageButton" runat="server"
m> ImageUrl="images\myimage.bmp" OnClick="Button_Click" Visible="False"
m> />
m> m> the error list pane, shows this error:
m> m> File image\myimage.bmp was not found. But when I am compiling the
m> application, it works correctly (can see the image button and the
m> image on it.)
m> m> What is the problem and how can I solve it?
m> m> Where is the best place to put images and other resources for a web
m> application? How to use them in an application. Any reference
m> material on this?
m> m> Regards
m>
 
M

mark4asp

Hello,

I have a page with a image button. I defined it as follow:

<asp:ImageButton ID="ImageButton" runat="server"
ImageUrl="images\myimage.bmp" OnClick="Button_Click" Visible="False" />

the error list pane, shows this error:

File image\myimage.bmp was not found. But when I am compiling the
application, it works correctly (can see the image button and the image on
it.)

What is the problem and how can I solve it?

Where is the best place to put images and other resources for a web
application? How to use them in an application. Any reference material on
this?

Regards

ImageUrl="~/images/myimage.bmp" OnClick="Button_Click" Visible="False"
/>

??? or

ImageUrl="/images/myimage.bmp" OnClick="Button_Click" Visible="False" />

try it first with the squiggle. "/ is the more universal notation
(being UNIX and all. It also has the advantage of NOT indicating the
start of a C# escape character). So I find that using "~/ to start a
URL is nearly always best.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top