Asp.net mvc retriev images from db and display on Page
        Posted  
        
            by Trey Carroll
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Trey Carroll
        
        
        
        Published on 2010-03-24T21:40:09Z
        Indexed on 
            2010/03/24
            21:43 UTC
        
        
        Read the original article
        Hit count: 329
        
//Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>"
<h2>ListVideos</h2>
<% foreach(BusinessObjects.Video vid in Model.VideoList){%>
<div class="videoBox">
       <%= Html.Encode(vid.Name) %>
       <img src="<% vid.ThumbnailImage; %>" />      
</div>
<%} %>
//ListVideosViewModel
public class ListVideosViewModel
{
    public IList<Video> VideoList { get; set; }
}
//Video
public class Video
{        
    public long VideoId { get; set; }
    public long TeamId { get; set; }
    public string Name { get; set; }
    public string Tags { get; set; }
    public string TeamMembers { get; set; }
    public string TranscriptFileName { get; set; }
    public string VideoFileName { get; set; }
    public int TotalNumRatings { get; set; }
    public int CumulativeTotalScore { get; set; }
    public string VideoUri { get; set; }
    public Image ThumbnailImage { get; set; }
}
I am getting the "red x" that I usually associate with image file not found. I have verified that my database table shows <binary data> after the stored proc that uploads the image executes. Any insight or advice would be greatly appreciated.
© Stack Overflow or respective owner