I've got a listview, which holds a bitmap (imagebutton) and details of the video. When I load the page this list should populate. All the details of the video clip populates, but no image is displayed. I store the images and videos in a folder, and the path of the images in a sql database. How do populate the image in the imagebutton? This is what I've done:
<asp:ListView runat="server" ID="lvlist" >
<LayoutTemplate>
<div id="itemPlaceholder" runat="server" />
</LayoutTemplate>
<ItemTemplate>
<br />
<div style="height:100px;">
<a href="PlayVideo.aspx?vid=<%# DataBinder.Eval(Container.DataItem, "ID") %>">
<asp:ImageButton id="imgVidThumbnail" runat="server" AlternateText="Watch"
ImageAlign="left" Width="150" Height="120px" style="margin-bottom:10px; margin-left: 32px; margin-right:15px;"
ImageUrl='<%#Eval("ThumbPath") %>' CommandArgument='<%#Eval("ThumbPath") %>'/>
</a>
<asp:Label ID="Label4" runat="server" Text="Title: " CssClass="ltrTitle" Width="100px" ></asp:Label>
<asp:Label ID="ltrTitle" runat="server" Text='<%#Eval("FileTitle") %>' CssClass="ltrTitle" Width="300px" ></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text="Date Uploaded: " CssClass="ltrTitle" Width="100px" ></asp:Label>
<asp:Label ID="ltrDateUploaded" runat="server" Text='<%#Eval("DateUploaded") %>' CssClass="ltrTitle" Width="200px" ></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" Text="Description: " CssClass="ltrTitle" Width="120px" ></asp:Label>
<div id="div" style="overflow-x:auto; overflow-y:auto; width:75%; max-width:75%; height:55px; max-height:55px; word-break:break-all; background-color:ghostwhite;" runat="server">
<asp:Label ID="ltrDescription" runat="server" Text='<%#Eval("Description") %>' CssClass="ltrTitle" Width="75%" ></asp:Label>
</div>
</div>
<br /> <br />
</ItemTemplate>
</asp:ListView>
private void BindList()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RoadHogzConnectionString"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("Select * from VideoInfo", con);
cmd.ExecuteNonQuery();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds, "Video");
Session["videos"] = ds;
lvlist.DataSource = GetVideoList("Select * FROM VideoInfo");
lvlist.DataBind();
}
Any help will be greatly appreciated!
EDIT: The path will change from month to month.. the only part that will stay the same is uploads and the last folder: the folder path will be like \uploads\Year\Month\thumb - month and year will change every month and every year.....
Edit: My view source of the path gives out extra characters: this is the method to display image here then it gives me the below code: ImageUrl ='<%= ResolveClientUrl(Eval("ThumbPath"))%>'
<a href="PlayVideo.aspx?vid=1038">
<input type="image" name="ctl00$MainContent$lvlist$ctrl1$imgVidThumbnail" id="MainContent_lvlist_imgVidThumbnail_1" src="<%=%20ResolveClientUrl(Eval("ThumbPath"))%>" alt="Watch" align="left" style="height:120px;width:150px;margin-bottom:10px; margin-left: 32px; margin-right:15px;" />
</a>
With this ImageUrl='<%#Eval("ThumbPath") %>' it displays the correct path in source view, but still no image....