I am first working on this module. Target is to show all the pictures from images folder to datalist. I myself got the code from other sources and not getting the logic that's why I am continuously receiving error..
<asp:DataList ID="dlpic" runat="server" RepeatDirection="Horizontal" RepeatColumns = "4">
<ItemTemplate>
<img src='<%# Bind("Name","~/images/Gallery/{0}") %>' class="scale-with-grid" />
<a id="imageLink" href='<%# Bind("Name","~/images/Gallery/{0}") %>' class="zoom prettyPhoto" runat="server" >
</a>
</ItemTemplate>
</asp:DataList>
and here is server side code
string[] filePaths = Directory.GetFiles(MapPath("~/images/Gallery/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "images/Gallery/" + fileName));
}
dlpic.DataSource = files;
dlpic.DataBind();
Help?