Datalist调用本地文件绑定图片
<asp:DataList ID="dList1" runat="server" RepeatColumns="4">
<ItemTemplate>
<asp:Image runat="server" ID="img1" ImageUrl='<%# Eval("Name","~/Images/{0}") %>' Width="50px" Height="40px" name="imgA" />
<img src="images/aa.jpg" width="50px" height="40px" onclick="show()" name="imgB"/>
</ItemTemplate>
</asp:DataList>
后台
string path =MapPath("~/Images/");
DirectoryInfo dir = new DirectoryInfo(path);
dList1.DataSource = dir.GetFiles();
dList1.DataBind();