View image in repeater
does not relates anything in LINQ.
Using Linq you create IEnumerable
List, so just bind it to the Repeater control using
Repeater.DataSource = IEnumerableObject;
Repeater.DataBind();
Now to view image you need to store the image into a valid location (might be a temporary folder) / you can directly write in Response Stream.
Do this in ItemDataBound
eventhandler.
protected void rptImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
string imagename = yourimagename;
HtmlImage imgImage = e.Item.FindControl("img") as HtmlImage;
string imagepath = Path.Combine(Path.Combine(Request.PhysicalApplicationPath,
"tempImages"), imagename);
if (!File.Exists(imagepath))
File.WriteAllBytes(imagepath, image.Image);
imgImage.Src = "~/tempImages/" + imagename;
imgImage.Attributes["title"] = imagename;
}
}
Remember to modify yourimagename
with the filename you want for the particular image.
I have shown this using temporary folder, you can easily modify this using a separate handler and write the entire filebytes
in response stream.