手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net 获取文件夹中的图片的代码
asp.net 获取文件夹中的图片的代码
摘要:前台:复制代码代码如下:后台代码:复制代码代码如下:stringpath=Server.MapPath("img");//获取img文件夹的...

前台:

复制代码 代码如下:

<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();

【asp.net 获取文件夹中的图片的代码】相关文章:

asp.net下实现URL重写技术的代码

asp.net图片上传实例

Asp.net中的mail的发送

asp.net(c#)中取得文件物理路径

asp.net实现C#绘制太极图的方法

实现ASP.NET多文件上传程序代码

asp.net DiscuzNT登录,退出的代码

asp.net汉字转拼音和获取汉字首字母的代码

记录asp.net网站是什么原因导致停止运行的代码

asp.net 事件与委托分析

精品推荐
分类导航