前台:

<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="5"
                CellSpacing="25">
                <ItemTemplate>
                    <img src="<%# Eval("FullName") %>" width="50" height="50" border="0" >
                </ItemTemplate>
            </asp:DataList>

------------------------------------------------------------------------------------------------------------

string path = Server.MapPath("img");//获取img文件夹的路径
                Response.Write(path);
                DirectoryInfo di = new DirectoryInfo(path);
                //DataList1.DataSource = di.GetFiles("*.jpg");只获取jpg图片
                DataList1.DataSource = di.GetFiles();//获取文件夹下所有的文件
                DataList1.DataBind();

相关文章:

  • 2021-08-28
  • 2021-09-01
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案