sameer shaikh

sameer shaikh

  • NA
  • 177
  • 38.6k

How to bind image url to Image control?

Jun 14 2017 7:25 AM
Hi
 
I have a image tag in asp.net form and binding image url dynamically to image tag, but its not working,
 
I have used below code
 
public static string ImageName { get; set; }
public static string ImageURL { get; set; } 
ImageName="welcome.png" ;
ImageURL="~/Slider/"+ImageName;
 
<img id="img1" src='<%= ImageURL %>' runat="server">  even i tried like

<img id="img1" src='<%# Eval("ImageURL") %>' runat="server">
 
<img id="img1" src='<%# string.Format("~/Slider/{0}", Eval("ImageName")) %>'  runat="server">
 
but its also not working to me.
 
 
 
Please let me know how to fix it 
 
Thanks & Regards 
Sameer Shaikh 

Answers (3)