您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->BlogEngine v1.3 多皮肤多语言版源码>>admin/Pages/Pages.aspx.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:BlogEngine v1.3 多皮肤多语言版源码


当前文件路径:BlogEngine/admin/Pages/Pages.aspx.cs 文件类型
普通视图
		            
1Using 12 13public partial class admin_Pages_pages : System.Web.UI.Page { 14 protected void Page_Load(object sender, EventArgs e) { 15 base.MaintainScrollPositionOnPostBack = true; 16 17 if (!Page.IsPostBack && !Page.IsCallback) { 18 if (!String.IsNullOrEmpty(Request.QueryString["id"]) && Request.QueryString["id"].Length == 36) { 19 Guid id = new Guid(Request.QueryString["id"]); 20 BindPage(id); 21 BindParents(id); 22 } else { 23 BindParents(Guid.Empty); 24 } 25 26 BindPageList(); 27 } 28 29 btnSave.Click += new EventHandler(btnSave_Click); 30 btnSave.Text = Resources.labels.savePage; // mono does not interpret the inline code correctly 31 btnUploadFile.Click += new EventHandler(btnUploadFile_Click); 32 btnUploadImage.Click += new EventHandler(btnUploadImage_Click); 33 Page.Title = Resources.labels.pages; 34 35 if (!Utils.IsMono) 36 Page.Form.DefaultButton = btnSave.UniqueID; 37 } 38 39 private void btnUploadImage_Click(object sender, EventArgs e) { 40 Upload(BlogSettings.Instance.StorageLocation + "files" + Path.DirectorySeparatorChar, txtUploadImage); 41 string path = System.Web.VirtualPathUtility.ToAbsolute("~/"); 42 string img = string.Format("<img src=\"{0}image.axd?picture={1}\" alt=\"\" />", path, Server.UrlEncode(txtUploadImage.FileName)); 43 txtContent.Text += string.Format(img, txtUploadImage.FileName); 44 } 45 46 private void btnUploadFile_Click(object sender, EventArgs e) { 47 Upload(BlogSettings.Instance.StorageLocation + "files" + Path.DirectorySeparatorChar, txtUploadFile); 48 49 string a = "<p><a href=\"{0}file.axd?file={1}\">{2}</a></p>"; 50 string text = txtUploadFile.FileName + " (" + SizeFormat(txtUploadFile.FileBytes.Length, "N") + ")"; 51 txtContent.Text += string.Format(a, Utils.RelativeWebRoot, Server.UrlEncode(txtUploadFile.FileName), text); 52 } 53 54 private void Upload(string virtualFolder, FileUpload control) { 55 string folder = Server.MapPath(virtualFolder); 56 control.PostedFile.SaveAs(folder + control.FileName); 57 } 58 59 private string SizeFormat(float size, string formatString) { 60 if (size < 1024) 61 return size.ToString(formatString) + " bytes"; 62 63 if (size < Math.Pow(1024, 2)) 64 return (size / 1024).ToString(formatString) + " kb"; 65 66 if (size < Math.Pow(1024, 3)) 67 return (size / Math.Pow(1024, 2)).ToString(formatString) + " mb"; 68 69 if (size < Math.Pow(1024, 4)) 70 return (size / Math.Pow(1024, 3)).ToString(formatString) + " gb"; 71 72 return size.ToString(formatString); 73 } 74 75 Event handlers 119 120 Data binding 166} 167
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:BlogEngine v1.3 多皮肤多语言版源码

- 最简单三层登陆入门源码

- 简单数据查询与报表打印系统源码

- Ftp在线注册管理系统源码

- Asp.net考勤系统源码

- 青岛分类信息网源码

- DataGrid数据增删及分页演示

- ASP.NET经典案例源码之用户管..

- Discuz!NT2.0源码

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号