您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.0正式版源码>>BlogControls/Views/ArchiveList.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
当前文件:文件类型 SpaceBuiderV10Source/BlogControls/Views/ArchiveList.cs打开代码结构图
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections.Generic; 9using System.Text; 10using System.Web.UI.WebControls; 11using System.Collections; 12using SpaceBuilder.Blogs.Components; 13 14namespace SpaceBuilder.Blogs.Controls 15{ 16 public class ArchiveList : WeblogThemedControl 17 { 18 Repeater archiveListRepeater; 19 protected override void AttachChildControls() 20 { 21 archiveListRepeater = FindControl("ArchiveListRepeater") as Repeater; 22 archiveListRepeater.ItemDataBound += new RepeaterItemEventHandler(ArchiveListRepeater_ItemDataBound); 23 } 24 25 protected override void OnLoad(EventArgs e) 26 { 27 base.OnLoad(e); 28 EnsureChildControls(); 29 if (!Page.IsPostBack) 30 DataBind(); 31 } 32 33 public override void DataBind() 34 { 35 base.DataBind(); 36 Bind(); 37 } 38 39 public void Bind() 40 { 41 List<ArchiveDataItem> list = BlogPosts.GetStatByMonths(CurrentWeblog.SectionID); 42 archiveListRepeater.DataSource = list; 43 archiveListRepeater.DataBind(); 44 } 45 46 void ArchiveListRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) 47 { 48 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 49 { 50 ArchiveDataItem item = e.Item.DataItem as ArchiveDataItem; 51 if (item == null) 52 return; 53 54 HyperLink archiveLink = e.Item.FindControl("ArchiveLink") as HyperLink; 55 if (archiveLink != null) 56 { 57 archiveLink.Text = item.Date.ToString("yyyy年MM月"); 58 archiveLink.NavigateUrl = BlogUrls.Instance().ShowBlogPostByMonth(CurrentWeblog.ApplicationKey, item.Date); 59 } 60 61 Literal itemCount = e.Item.FindControl("ItemCount") as Literal; 62 if (itemCount != null) 63 itemCount.Text = item.Count.ToString(); 64 } 65 } 66 67 68 } 69} 70
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilder v1.0正式版源码