This is my code in aspx file
cnn.Open();
SqlDataAdapter da1 = new SqlDataAdapter("select * from carousel", cnn);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
Rp1.DataSource = dt1;
Rp1.DataBind();
cnn.Close();
and this is repeater
<asp:Repeater id="Rp1" runat="server">
<ItemTemplate>
<div class="item">
<asp:Image ID="Image1" ImageUrl='<%# Eval("image") %>' runat="server" />
</div>
</ItemTemplate>
<footertemplate></footertemplate>
</asp:Repeater>
I tried everything but I am getting in result every time I really want some help on this, I am new to ASP.Net
suppose your image column name in database "ImageName" then
Solution 1:if your image in Root Folder
Solution 2:if your image in images Folder
OR
Your Final Solution:
This is because the value coming from the database is a byte array representing the actual data of the image. Whereas the
src
of animg
tag expects a URL to an image. There are essentially two ways to go about this...src
attribute.There are lots of tutorials for the first option online. This one was found by a quick Google search, there are others as well. Essentially what the handler would do is accept an identifier on the query string, use that identifier to get the image from the database, then write the appropriate headers and content to the response. The URL for the
src
attribute would then be that handler. Something like:(Or whatever your data-bound data uses as an identifier for the image.)
You need to convert in URI for IMG HTML tag:
or equivalent.