您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->文件在线管理系统0.30源码>>WebSite/Manage/Notepad.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:文件在线管理系统0.30源码
当前文件:文件类型 FileManager/WebSite/Manage/Notepad.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.IO; 3using ptw.FileManager.Web.Processor; 4 5public partial class Manage_Notepad : System.Web.UI.Page 6{ 7 protected void Page_Load(object sender, EventArgs e) 8 { 9 if (!IsPostBack) 10 { 11 string filePath = Request.QueryString["objfile"]; 12 string folderPath = Request.QueryString["objfolder"]; 13 14 if (string.IsNullOrEmpty(folderPath)) 15 { 16 if (File.Exists(filePath)) 17 { 18 string fileContent; 19 string getEncode; 20 21 new FileManagerProcessor().ReadTextFile(filePath, out fileContent, out getEncode); 22 23 lblNew.Text = "false"; 24 txtFilePath.Text = filePath; 25 txtFileContent.Text = fileContent; 26 ddlEncode.SelectedValue = getEncode; 27 } 28 else 29 { 30 lblMsg.Text = "<script type=\"text/javascript\">alert(\"没有找到文件\");</script>"; 31 } 32 } 33 else 34 { 35 lblNew.Text = "true"; 36 txtFilePath.Text = folderPath + "\\newText.txt"; 37 txtFilePath.ReadOnly = false; 38 txtFileContent.Text = "在此输入文本内容"; 39 } 40 } 41 42 btnSave.Click += new EventHandler(OnSaveFile); 43 } 44 45 /// <summary> 46 /// 保存文件 47 /// </summary> 48 protected void OnSaveFile(object sender, EventArgs e) 49 { 50 string filePath = txtFilePath.Text; 51 string fileContent = txtFileContent.Text; 52 string fileEncode = ddlEncode.SelectedValue; 53 bool fileNew = Convert.ToBoolean(lblNew.Text); 54 55 if (fileNew) 56 { 57 if (File.Exists(filePath)) 58 { 59 lblMsg.Text = "<script type=\"text/javascript\">alert(\"新建的文本文档名称目录下已存在\");</script>"; 60 return; 61 } 62 } 63 64 lblMsg.Text = new FileManagerProcessor().SaveTextFile(filePath, fileContent, fileEncode); 65 } 66}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:文件在线管理系统0.30源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号