When I'm in the page designer I can see the image fine, but as soon as I run the page I just see the standard red cross. I tried using a jpg and a gif version as well.
If I am not mistaken the app_data folder in your application is one of the asp.net application folders. These folders are not visible to the world when running your application, and righly so. In your case you have your image in the app_data folder which
is used to store your database files, you wouldn't want the outside users to have access to this folder. Try moving your image to the root of the application or to another folder to store images for your application and adjust the path accordingly in the
ImageUrl property of your ImageButton.
Regards,
Michael Reyeros
Please remember to mark this post as answered if it helped you to answer your question, thanks.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Marked as answer by GlennC on Sep 26, 2007 02:39 PM
GlennC
Member
1 Points
7 Posts
ImageButton: Image only display in design time.
Sep 26, 2007 10:30 AM|LINK
Hi,
I'm new to ASP so sorry in advance for what's probably a very simple question.
I've got an image button displaying a small calendar picture.
<asp:ImageButton ID="imgCal1" runat="server" Height="29px" ImageUrl="~/App_Data/calendar1.PNG" OnClick="imgCal1_Click" Style="z-index: 113; left: 356px; position: absolute; top: 331px" Width="38px" />When I'm in the page designer I can see the image fine, but as soon as I run the page I just see the standard red cross. I tried using a jpg and a gif version as well.
What am I doing wrong???
Sorry again if this is a stupid question!
Thanks.
mreyeros
Contributor
4022 Points
736 Posts
Re: ImageButton: Image only display in design time.
Sep 26, 2007 01:33 PM|LINK
If I am not mistaken the app_data folder in your application is one of the asp.net application folders. These folders are not visible to the world when running your application, and righly so. In your case you have your image in the app_data folder which is used to store your database files, you wouldn't want the outside users to have access to this folder. Try moving your image to the root of the application or to another folder to store images for your application and adjust the path accordingly in the ImageUrl property of your ImageButton.
Regards,
Michael Reyeros
Please remember to mark this post as answered if it helped you to answer your question, thanks.
GlennC
Member
1 Points
7 Posts
Re: ImageButton: Image only display in design time.
Sep 26, 2007 02:43 PM|LINK
Thanks a lot Michael! [:D] That worked fine!