Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
i wanted to set the path of Image at run time and and i made the give the path to the image Scr and it not getting the path :


<image Scr=    "http://Localhost/BL7HRISNew/EmpImages/Full/3534533.jpg"/> 


then its getting the value and displaying the image.but what i need is to give that image name based on user inputs. lets say user select a employee with empCode A00001. then i want to get that particular employee image from the location and have to display the image .for that i have to pass the image name for html tag. so i did the following :

<image Scr=    "http://Localhost/BL7HRISNew/EmpImages/Full/" +" <% viewbag.imageName %> "+".jpg"/>

but it not worked. viewbag having the value.but in run time image is not displaying. someone has any idea on that?
Thanks a Lot!!!
Posted
Updated 12-Feb-13 18:18pm
v2
Comments
Sergey Alexandrovich Kryukov 13-Feb-13 1:10am    
What runtime? You did not mention any server-side technology
—SA
Hesha 13-Feb-13 3:56am    
i'm using MVC asp.net.
Sergey Alexandrovich Kryukov 13-Feb-13 11:39am    
Thank what's your problem. After a re-post, the HTML page is in fact a brand new versions of this page; so you can generated any other image. All the run time of your ASP.NET code behind goes between HTTP request and HTTP response. You can even generate a new image on the fly. You need to check up if the image is really available at the URI of the src attribute, and then make sure it is available (generated, or whatever).
—SA
Guirec 13-Feb-13 1:17am    
if your viewbag contains the imageName are you sure it does not contain its extension as well? If yes you have to remove the +".jpg" part in your model.
Sergey Alexandrovich Kryukov 13-Feb-13 11:40am    
It can be so... I don't understand what prevents OP from checking the URI. It can be done even on client site only, via "View Page Source"...
—SA

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