private void SFUPC() //该方法用于将当前页面上传文件控件集保存到Session中 { ArrayList AL = new ArrayList(); //动态增加数组 foreach (Control C in Tab_UpDownFile.Controls) { //在表格中查找出FileUpload控件添加到ArrayList中 if (C.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlTableRow") { HtmlTableCell HTC = (HtmlTableCell)C.Controls[0]; foreach (Control FUC in HTC.Controls) { if (FUC.GetType().ToString() == "System.Web.UI.WebControls.FileUpload") { FileUpload FU = (FileUpload)FUC; //添加FileUpload控件 AL.Add(FU); } } } } //把ArrayList添加到Session中 Session.Add("FilesControls", AL); }
private void SaveFUC() { //創建動態增加陣列 ArrayList AL = new ArrayList(); foreach (Control C in tabFU.Controls) { if (C.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlTableRow") { HtmlTableCell HTC = (HtmlTableCell)C.Controls[0]; foreach (Control FUC in HTC.Controls) { //判斷該控制項是否為上傳控制項(FileUpLoad),如果是,則添加到ArrayList中 if (FUC.GetType().ToString() == "System.Web.UI.WebControls.FileUpload") { FileUpload FU = (FileUpload)FUC; AL.Add(FU); } } } } //將保存在陣列ArrayList中的所有上傳控制項(FileUpLoad),添加到緩存中,命名為“FilesControls” Session.Add("FilesControls", AL); }
/// <summary> /// 用于保存当前页面上传文件控件集到缓存中 /// </summary> protected void SaveFUC() { //创建动态增加数组 ArrayList AL = new ArrayList(); foreach (Control C in tabFU.Controls) { if (C.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlTableRow") { HtmlTableCell HTC = (HtmlTableCell)C.Controls[0]; foreach (Control FUC in HTC.Controls) { //判断该控件是否为上传控件(FileUpLoad),如果是,则添加到ArrayList中 if (FUC.GetType().ToString() == "System.Web.UI.WebControls.FileUpload") { FileUpload FU = (FileUpload)FUC; AL.Add(FU); } } } } //将保存在数组ArrayList中的所有上传控件(FileUpLoad),添加到缓存中,命名为“FilesControls” Session.Add("FilesControls", AL); }