I have a datalist with an image control whose aspx code is
<asp:DataList ID="DataList1" runat="server"
RepeatDirection="Horizontal" RepeatColumns="4">
<ItemTemplate>
<div>
<asp:Image ID="Image1" ImageUrl='<%#Eval("IMAGE") %>'
runat="server" Height="75px" Width="75px" />
</div>
</ItemTemplate>
</asp:DataList>
The code that I'm trying to get images from the database is
PagedDataSource objds = new PagedDataSource();
string query = "SELECT * FROM Icon";
SqlConnection con = new SqlConnection();
con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ICONBANKConnectionString"].ConnectionString;
try
{
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
//SqlDataReader dr = cmd.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(query, con);
DataSet ds = new DataSet();
da.Fill(ds, "images");
objds.DataSource = ds.Tables[0].DefaultView;
DataList1.DataSource = objds;
DataList1.DataBind();
con.Close();
}
catch (Exception)
{
throw;
}
the sql table looks like this
Icon( ID, SUBCAT_ID, ALBUM_ID, SUBCAT_NAME, ALBUM_NAME, IMAGE, ICON_SIZE,
BLACKWHITE, NAME, DESIGNER, HITS, RATINGS, PRICE)
When I debug the code it shows the table rows in dataset but when I run the page it is not showing me the image.... Kindly guide me what is the problem behind it. One More thing the image was stored in database is in binary format