How to show the image from folder based on conditions ...in ListRepeater
/////////////////////////////////////////in design aspx
<div style="width: 100%;">
<ul id="toolbar">
<asp:Repeater runat="server" id="ListRepeater" >
<ItemTemplate>
<div style=" height:60px; width:60px; float: left;">
<a id = "ProdDetail" style="text-decoration: none;" href="#" onserverclick = "SetImage" name='<%# Container.DataItem %>' runat="server">
<asp:Image id="Image" runat="server" imageurl='<%# Container.DataItem %>' style="height:60px; width:60px; border:1px solid gray;" />
</a>
</div>
/////////////////////////in code behind makes a method and call in any event.....
void addsubimage()
{
string path = HttpContext.Current.Request.PhysicalApplicationPath + @"\ItemsPics";
string [] strFile = Directory.GetFiles(path, lblpc.Text + "-*");
int size = strFile.Length;
if (size <= 1)
return;
List<String> images = new List<string>(strFile);
for (int i = 0; i < size; i++)
{
images.RemoveAt(i);
images.Insert(i, strFile.GetValue(i).ToString().Replace(path + "\\", "~/ItemsPics/"));
}
ListRepeater.DataSource = images;
ListRepeater.DataBind();
}