Click here to Skip to main content
15,919,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
I am using 'img' control in ASP.NET to display images. I am assigning the imageurl with the image file path coming from database as below:
imgMain.ImageUrl = ImagePath;

This program run and load images from URL with Internet Explorer. Fine.

But when want to run with mozilla Firefox, image is not shown in Image Panel. Please help me.

Code is:
//Funtion in Client side as like below:
function fnSetImage(filepath)
     return false;
Updated 1-Oct-10 20:16pm
raju melveetilpurayil 2-Oct-10 2:54am    
did you check image url in source file?

1 solution


Please put ../ on your image path like

//Funtion in Client side as like below:
function fnSetImage(filepath)
     document.getElementById('<%=imgMain.ClientID%>').src= '../' + filepath;
     return false;

Please do let me know, if you have any doubt.

Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:

Share this answer
Ankur\m/ 4-Oct-10 1:45am    
And WHY??
Sunasara Imdadhusen 4-Oct-10 1:49am    
Because the path would be relative
Ankur\m/ 4-Oct-10 2:06am    
It is quite possible that the value of 'ImagePath' has a relative path stored in it.
Moreover even if it's an absolute path, how would that work. What I mean is: Suppose, ImagePath = "d:\NewFolder\Image1.jpg" you are saying put a ../ before it. So that becomes ../d:\NewFolder\Image1.jpg which I guess, is not a valid path.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900