标签:get ima set cli dir box select trim checkbox
1 /// <summary> 2 /// 上传文件并显示出文件列表 3 /// </summary> 4 /// <param name="sender"></param> 5 /// <param name="e"></param> 6 protected void ImageButton2_Click(object sender, ImageClickEventArgs e) 7 { 8 // string FileNameStr = MYCLASS.PublicMethod.UploadFileIntoDir(this.FileUpload1, DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)); 9 if (FileUpload1.FileName != "") 10 { 11 string FileNameStr = DateTime.Now.ToString("yyyymmddhhmmss") + FileUpload1.FileName; 12 if (MYCLASS.PublicMethod.GetSessionValue("WenJianList").Trim() == "") 13 { 14 MYCLASS.PublicMethod.SetSessionValue("WenJianList", FileNameStr); 15 } 16 else 17 { 18 MYCLASS.PublicMethod.SetSessionValue("WenJianList", MYCLASS.PublicMethod.GetSessionValue("WenJianList") + "|" + FileNameStr); 19 } 20 if (FileUpload1.FileName != "") 21 { 22 FileUpload1.SaveAs(Server.MapPath("~/gongshi/" + FileNameStr)); 23 } 24 MYCLASS.PublicMethod.BindDDL(this.CheckBoxList1, MYCLASS.PublicMethod.GetSessionValue("WenJianList")); 25 // this.Label2.Text = MYCLASS.PublicMethod.GetWenJian(MYCLASS.PublicMethod.GetSessionValue("WenJianList"), "../gongshi/"); 26 } 27 } 28 /// <summary> 29 /// 删除已选择的附件 30 /// </summary> 31 /// <param name="sender"></param> 32 /// <param name="e"></param> 33 protected void ImageButton3_Click(object sender, ImageClickEventArgs e) 34 { 35 try 36 { 37 for (int i = 0; i < this.CheckBoxList1.Items.Count; i++) 38 { 39 if (this.CheckBoxList1.Items[i].Selected == true) 40 { 41 MYCLASS.PublicMethod.SetSessionValue("WenJianList", MYCLASS.PublicMethod.GetSessionValue("WenJianList").Replace(this.CheckBoxList1.Items[i].Value, "").Replace("||", "|")); 42 } 43 } 44 MYCLASS.PublicMethod.BindDDL(this.CheckBoxList1, MYCLASS.PublicMethod.GetSessionValue("WenJianList")); 45 } 46 catch 47 { } 48 }
标签:get ima set cli dir box select trim checkbox
原文地址:http://www.cnblogs.com/Doumiao/p/6398712.html