Why am I getting this error?

  • Thread starter Thread starter ma
  • Start date Start date
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
 
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>
 
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
 
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>
 
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.
 
Back
Top