I have a dynamic string that gets the server map path, lets call it strPath.
I’m trying to pass the value of this string to html by using <%strPath%> however it doesnt work. Any help would be greatly appreciated.
Dont mind the string here is static, once I can successfuly show the picture I’ll make it dynamic.
protected void Page_Load(object sender, EventArgs e)
{
string imagePath = Server.MapPath("../Uploads/" + "10.jpg");
}
<asp:Image runat="server" ImageUrl="<%imagePath%>" />
Why not use an
<asp:Image>and set the ImageUrl property on server side?Then on your code behide: