Asp.net源码专业站
首页->博客空间->I-favourite2.0多用户博客系统源码>>Admin/AlbumList.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:I-favourite2.0多用户博客系统源码
当前文件:文件类型 iFavourite20/Admin/AlbumList.aspx.cs[3K,2009-6-12 11:44:57]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using Spaces; 12using Spaces.Controls; 13public partial class Admin_AlbumList : AdminPage 14{ 15 string pathFormat = string.Empty; 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 rprAlbumList.ItemCreated += new RepeaterItemEventHandler(rprAlbumList_ItemCreated); 19 rprAlbumList.ItemCommand += new RepeaterCommandEventHandler(rprAlbumList_ItemCommand); 20 //if (!IsPostBack) 21 //{ 22 pathFormat = string.Format("{0}/{1}/{2}/small/{3}", Config.GetConfig().PhotosUrl, User.Identity.Name, "{0}", "{1}"); 23 BindAlbums(); 24 // } 25 } 26 27 void rprAlbumList_ItemCommand(object source, RepeaterCommandEventArgs e) 28 { 29 if (e.CommandName.ToLower() == "delete") 30 { 31 int id = Convert.ToInt32(e.CommandArgument); 32 Photos.DelCategory(id); 33 } 34 BindAlbums(); 35 } 36 37 void rprAlbumList_ItemCreated(object sender, RepeaterItemEventArgs e) 38 { 39 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 40 { 41 PhotoCategory c = e.Item.DataItem as PhotoCategory; 42 if (c != null) 43 { 44 Image icon = e.Item.FindControl("CategoryIcon") as Image; 45 if (icon != null) 46 { 47 if (c.MainPhotoID > 0) 48 icon.ImageUrl = string.Format(pathFormat, c.ID, c.Image); 49 else 50 icon.ImageUrl = string.Format("{0}/images/NoPhoto.gif", Globals.ApplicationPath); 51 } 52 HyperLink AlbumName = e.Item.FindControl("AlbumName") as HyperLink; 53 if (AlbumName != null) 54 { 55 AlbumName.Text = c.Name; 56 AlbumName.NavigateUrl = string.Format("PhotoList.aspx?categoryID={0}", c.ID); 57 } 58 Literal NumPhotos = e.Item.FindControl("NumPhotos") as Literal; 59 if (NumPhotos != null) 60 { 61 NumPhotos.Text = string.Format("{0}张", c.NumPhotos); 62 } 63 Literal Updated = e.Item.FindControl("Updated") as Literal; 64 if (Updated != null) 65 { 66 Updated.Text = c.Updated.ToString("yy-M-dd hh:mm"); 67 } 68 HyperLink EditCategory = e.Item.FindControl("EditCategory") as HyperLink; 69 if (EditCategory != null) 70 { 71 EditCategory.NavigateUrl = string.Format("PhotoClassEdit.aspx?CategoryID={0}", c.ID); 72 } 73 LinkButton lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton; 74 if (lnkDelete != null) 75 { 76 lnkDelete.CommandArgument = c.ID.ToString(); 77 if (c.NumPhotos > 0) 78 lnkDelete.OnClientClick = "alert('请先删除该目录下所有图片。');return false;"; 79 else 80 lnkDelete.OnClientClick = "return confirm('是否真的删除该目录?')"; 81 } 82 } 83 84 } 85 } 86 void BindAlbums() 87 { 88 rprAlbumList.DataSource = Photos.GetCategories(User.Identity.Name); 89 rprAlbumList.DataBind(); 90 } 91} 92
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:I-favourite2.0多用户博客系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146