using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace BSCRM.Shangpin
{
/// <summary>
/// Shangpin_picview 的摘要说明。
/// </summary>
public class Shangpin_picview : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
string ImagePath = ConfigurationSettings.AppSettings["ImagePath"];
string ImageType = "*.jpg|*.jpeg|*.bmp|*.ico|*.emf|*.wmf";
DataSet ds;
FileInfo[] ff;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
DirectoryInfo di = new DirectoryInfo(ImagePath);
ff = di.GetFiles();
DataGrid1.DataSource = this.GetFileInfo(di,ImageType);
DataGrid1.DataBind();
}
public Object[] GetFileInfo(System.IO.DirectoryInfo dirInfo,string sSearchPattern)
{
string[] sSearch=sSearchPattern.Split('|');
System.Collections.ArrayList al=new System.Collections.ArrayList();
System.IO.FileInfo[] fiTemp=null;
for(int i=0;i<sSearch.Length;i++)
{
fiTemp=dirInfo.GetFiles(sSearch[i].ToString());
al.AddRange(fiTemp);
}
return al.ToArray();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}