469,332 Members | 6,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

How to assign imageurl to image button

Hi,

i had created image button and assigned image url as per the below code

imagebutton1.imageurl = server.mappath("photo")+ "\" + imagefilename
photo -> image folder in my project
imagefilename -> retrieving from database(including extension like .jpg,etc)

and also i had created image button thru html coding as

<img id="imgbtn" runat="server">

and in codebehind page load event

imgbtn.src = server.mappath("photo")+ "\" + imagefilename

but both the codings are working in local system but not in server.

i checked path coding( server.mappath("photo")+ "\" + imagefilename) by assigning to textbox. its working correctly but image is not displayed.

deletion,creation,updation everything is happening but only problem is displaying image.

How can i resolve this problem.
May 12 '07 #1
2 2339
shweta123
692 Expert 512MB
Hi,

You can try for giving webpath for the ImageUrl
e.g

http://localhost/YourProject/imagefilename


instead of
server.mappath("photo")+ "\" + imagefilename
May 13 '07 #2
gomzi
304 100+
Hi,

i had created image button and assigned image url as per the below code

imagebutton1.imageurl = server.mappath("photo")+ "\" + imagefilename
photo -> image folder in my project
imagefilename -> retrieving from database(including extension like .jpg,etc)

and also i had created image button thru html coding as

<img id="imgbtn" runat="server">

and in codebehind page load event

imgbtn.src = server.mappath("photo")+ "\" + imagefilename

but both the codings are working in local system but not in server.

i checked path coding( server.mappath("photo")+ "\" + imagefilename) by assigning to textbox. its working correctly but image is not displayed.

deletion,creation,updation everything is happening but only problem is displaying image.

How can i resolve this problem.
How about trying this out ->
imagebutton1.imageurl = server.mappath("photo/") & imagefilename
May 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Leigh Kendall | last post: by
1 post views Thread by Nathan Sokalski | last post: by
3 posts views Thread by Thomas Satzinger | last post: by
2 posts views Thread by Jokerr | last post: by
4 posts views Thread by AG | last post: by
3 posts views Thread by Ganesh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.