您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.1源代码>>BlogControls/Club/CommendedBlogThreadListRepeater.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.1源代码
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Inc. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections.Generic; 9using System.Text; 10using System.Web.UI.WebControls; 11using SpaceBuilder.Utils; 12using SpaceBuilder.Clubs.Components; 13using SpaceBuilder.Components; 14using SpaceBuilder.Blogs.Components; 15using System.Web.UI; 16using SpaceBuilder.Posts.Components; 17using SpaceBuilder.Controls; 18using TunyNet.Data.Utils; 19using TunyNet.Utils; 20using System.Web.UI.HtmlControls; 21 22namespace SpaceBuilder.Blogs.Controls 23{ 24 /// <summary> 25 /// 圈子中的推荐博客文章列表 26 /// </summary> 27 public class CommendedBlogThreadListRepeater : Repeater 28 { 29 SBContext wlContext = SBContext.Current; 30 private PagingDataSet<CommendedPost> pds = null; 31 /// <summary> 32 /// 当前Repeater绑定的数据源,用于向外传出 33 /// </summary> 34 public PagingDataSet<CommendedPost> Entities 35 { 36 get { return pds; } 37 } 38 protected override void OnInit(EventArgs e) 39 { 40 base.OnInit(e); 41 this.EnableViewState = false; 42 } 43 public void Bind() 44 { 45 this.ItemDataBound += new RepeaterItemEventHandler(CommendedPostsRepeater_ItemDataBound); 46 47 this.CurrentClub = SpaceBuilder.Clubs.Components.Clubs.GetClub(SBContext.Current.ClubDomainName); 48 if (CurrentClub == null) 49 return; 50 51 if (OnlyShowMyBlogs && SBContext.Current.User.IsAnonymous) 52 { 53 this.Visible = false; 54 return; 55 } 56 57 CommendedPostQuery query = new CommendedPostQuery(); 58 query.ClubID = CurrentClub.ClubID; 59 query.ApplicationType = ApplicationType.Blog; 60 61 if (OnlyShowMyBlogs) 62 query.CommenderUserID = SBContext.Current.User.UserID; 63 64 query.IncludeTags = false; 65 query.PageSize = this.DisplayItemCount; 66 query.IgnorePaging = this.ignorePaging; 67 query.SortBy = this.SortBy; 68 query.SortOrder = this.SortOrder; 69 query.PageIndex = this.pageIndex; 70 71 pds = CommendedPosts.GetCommendedPosts(query); 72 if (pds.Records.Count > 0) 73 { 74 this.DataSource = this.pds.Records; 75 this.DataBind(); 76 } 77 else 78 { 79 this.DataSource = null; 80 this.DataBind(); 81 } 82 } 83 84 85 protected override void OnLoad(EventArgs e) 86 { 87 base.OnLoad(e); 88 if (this.Page.IsPostBack == false) 89 { 90 this.Bind(); 91 } 92 } 93 94 protected override void Render(HtmlTextWriter writer) 95 { 96 if (this.pds != null && this.pds.Records.Count > 0) 97 base.Render(writer); 98 } 99 100 事件 238 239 240 属性