您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.0正式版源码>>BlogControls/Club/CommendedBlogThreadListRepeater.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
普通视图
		            
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 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 public class CommendedBlogThreadListRepeater : Repeater 25 { 26 SBContext wlContext = SBContext.Current; 27 private PagingDataSet<CommendedPost> pds = null; 28 /// <summary> 29 /// 当前Repeater绑定的数据源,用于向外传出 30 /// </summary> 31 public PagingDataSet<CommendedPost> Entities 32 { 33 get { return pds; } 34 } 35 protected override void OnInit(EventArgs e) 36 { 37 base.OnInit(e); 38 this.EnableViewState = false; 39 } 40 public void Bind() 41 { 42 this.ItemDataBound += new RepeaterItemEventHandler(CommendedPostsRepeater_ItemDataBound); 43 44 this.CurrentClub = SpaceBuilder.Clubs.Components.Clubs.GetClub(SBContext.Current.ClubDomainName); 45 if (CurrentClub == null) 46 return; 47 48 if (OnlyShowMyBlogs && SBContext.Current.User.IsAnonymous) 49 { 50 this.Visible = false; 51 return; 52 } 53 54 CommendedPostQuery query = new CommendedPostQuery(); 55 query.ClubID = CurrentClub.ClubID; 56 query.ApplicationType = ApplicationType.Blog; 57 58 if (OnlyShowMyBlogs) 59 query.CommenderUserID = SBContext.Current.User.UserID; 60 61 query.IncludeTags = false; 62 query.PageSize = this.DisplayItemCount; 63 query.IgnorePaging = this.ignorePaging; 64 query.SortBy = this.SortBy; 65 query.SortOrder = this.SortOrder; 66 query.PageIndex = this.pageIndex; 67 68 pds = CommendedPosts.GetCommendedPosts(query); 69 if (pds.Records.Count > 0) 70 { 71 this.DataSource = this.pds.Records; 72 this.DataBind(); 73 } 74 else 75 { 76 this.DataSource = null; 77 this.DataBind(); 78 } 79 } 80 81 82 protected override void OnLoad(EventArgs e) 83 { 84 base.OnLoad(e); 85 if (this.Page.IsPostBack == false) 86 { 87 this.Bind(); 88 } 89 } 90 91 protected override void Render(HtmlTextWriter writer) 92 { 93 if (this.pds != null && this.pds.Records.Count > 0) 94 base.Render(writer); 95 } 96 97 事件 235 236 237 属性