i have simple datalist ,how can i add in this code?
<asp:DataList ID="DataList1" runat="server" RepeatColumns = "2" CellPadding = "4">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" width = "120px">
<tr>
<td align = "center">
<asp:Image ID="Image1" ImageUrl='<%# Eval("Value") %>' runat="server" Height="100"
Width="100" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Images/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "~/Images/" + fileName));
}
DataList1.DataSource = files;
DataList1.DataBind();
}
}