asp.netimagebuttonbroken-image

asp:ImageButton getting broken when loading debugging ASP.NET


Hi I have a imageButton and when I load IE 7, it shows a broken image for the picture, although when I go into Design in VS2010 it shows the picture.

Here is the code:

<asp:ImageButton ID="calendarImage" runat="server" ImageUrl="d:\mydocuments\ALM\ALM\ALM\imgs\calendar_button.jpg" Height="21px" Width="24px" />

Thanks, Greg


Solution

  • Why are you trying to set ImageUrl="d:\mydocuments\ALM\ALM\ALM\imgs\calendar_button.jpg" in this way ?

    You should put these images in your Website folder, then set the path like...

    ImageUrl="~/imgs/calendar_button.jpg"
    

    If you really want to set ImageURL the way you are proposing, I would not recommend it, but you can do it like...

    ImageUrl="d:\\mydocuments\\ALM\\ALM\\ALM\imgs\\calendar_button.jpg"
    

    You need to use double slash instead single slash in path