All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP关于代码转换问题比较完善的解决办法_php资料_编程技术
SQL之更多的子查询_[SQL,Server教程]
用IHttpModule解决输入中文地址乱码问题(二)_[Asp.Net教程]
PHP实例:一个比较完善的购物车类_[PHP教程]
ASP.NET中数据校验部分的封装与应用_.net资料_编程技术
Delphi在状态栏中显示检查框
新手教程:手把手教你学Web,Services,教程_.net资料_编程技术
使用SQLSERVER的扩展存储过程实现远程备份与恢复_[SQL Server教程]
c#中类的封装、继承和多态
PEAR简介_php资料_编程技术
Reading number is top 10 pictures
西游日记1
A man's favorite things16
Cesarean section, bloody, silently into it!2
Born After 90 Beijing sports university campus flower photos1
沙漠里的美女
美奂绝伦的风景
来几张有特色的图片
In 2013 hercules Arnold classic2
2012 national geographic daily picture6
西游日记4
Download software ranking
Detective task-the top secret prostitution files
Unix video tutorial8
linux高级编程
天龙八部最新服务端
Tram sex maniac 2 (H) rar bag5
Boxer's Top ten classic battle3
WebService在.NET中的实战应用教学视频 → 第2集
仙剑奇侠传98版歌曲
豪门浪荡史
中国结婚习俗实录
归海一刀 published in(发表于) 2014/1/30 1:17:50 Edit(编辑)
ASP.NET2.0显示文件夹下全部图片_[Asp.Net教程]

ASP.NET2.0显示文件夹下全部图片_[Asp.Net教程]

ASP.NET2.0显示文件夹下全部图片_[Asp.Net教程]
1.以下目录有若干图片(都是大图片)


2.在页面展现效果图



3.后台代码



using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Lifetime;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DirectoryInfo imagesfile = new DirectoryInfo(Server.MapPath("./images"));
DataList1.DataSource = imagesfile.GetFiles("*.jpg");
DataList1.DataBind();


}

}




前台代码:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>





遍历文件夹下所有图片 http://blog.csdn.net/21aspnet 清清月儿





&nbsp;

’/>







说明:如果大家想生成真正的缩略图就要在另个页面生成
ImageUrl=’<%#"AAA.aspx 取得生成的结果即可。可参考以下代码:

Example: SimpleImageHandler.ashx
<%@ WebHandler Language="C#" Class="SimpleImageHandler" %>

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Web;
using System.Web.Caching;

public class SimpleImageHandler : IHttpHandler {

public void ProcessRequest(HttpContext context)
{
// Load image.
Bitmap bmap = new Bitmap(@"C:\Temp\TEST.JPG");

// You could do something here, e.g. add some texts to image.

// Send back image.
context.Response.ContentType = "image/jpeg";
context.Response.BufferOutput = false;
bmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}

public bool IsReusable
{
get
{
return false;
}
}

}







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.