472,141 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

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 2417
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.