|
-
Feb 18th, 2009, 08:14 AM
#1
Thread Starter
Junior Member
[Resolved] [2008] ImageButton not displaying Image
Hello,
I have an ImageButton, which looks fine in the design mode, but when I run the application the image appears as a red 'x'.
<asp:ImageButton ID="imgExport" runat="server"
ImageUrl="~/App_Data/excel_icon.jpg" />
I think that the code looks OK and the permissions of the App_Data folder look fine, but I am at a loss of what to check next.
I'm sure its a newbie error, but I have potterd around for a while without finding the solution, I would welcome any help.
Last edited by Ping_Chow_Chi; Feb 20th, 2009 at 04:52 AM.
-
Feb 18th, 2009, 09:35 AM
#2
Frenzied Member
Re: [2008] ImageButton not displaying Image
Hi!
Have you checked the image url at runtime to see where it points? Then try and display this image by typing that url in the browser.
Also, try to create an "Images" folder in the webproject root and put your pictures there. There is no particular reason to put the images in App_Data. A better place would be the resx files if you want more control.
/Henrik
-
Feb 19th, 2009, 04:23 AM
#3
Thread Starter
Junior Member
Re: [2008] ImageButton not displaying Image
hi, thanks for the reply
I have put the pic in a pictures folder and get the following when look at the ImageURL at run time
~/App_Data/pictures/excel_icon.jpg
When I try to access it (I assume that this would be the correct path) using
http://localhost:63546/WebSite2/App_...excel_icon.jpg
I get
Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------
HTTP Error 403 - Forbidden.
--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 9.0.0.0
Last edited by Ping_Chow_Chi; Feb 19th, 2009 at 05:38 AM.
-
Feb 19th, 2009, 06:09 PM
#4
Re: [2008] ImageButton not displaying Image
Never place images in the App_Data folder. It is a special folder meant only for database related files. You need to move your images.
Also, note that images are not actually data, so logically they shouldn't be in the App_Data folder anyways.
-
Feb 20th, 2009, 04:52 AM
#5
Thread Starter
Junior Member
Re: [2008] ImageButton not displaying Image
Well, I moved it to a seperate folder outside of the app_data folder and .... hey presto it worked!
So, thankyou 
-
Feb 20th, 2009, 12:45 PM
#6
Re: [Resolved] [2008] ImageButton not displaying Image
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|