Friday, December 28, 2012

Show Image on the web page using the relative path

In my previous post i have demonstrated how to save the relative file path into a database table. Let's say you have uploaded images to a folder. Now you can retrieve the relative path from the database and assign it directly to the ASP.NET Image control "imageUrl" property.

<asp:Image ID="imgCover" runat="server" Height="80px" Width="80px" />

in the code behind on page load event add the below code.

 imgCover.ImageUrl= "retrieved path from database" //  Ex:~\BookCovers\1.jpg

No comments:
Write comments
Recommended Posts × +