protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { navPostRpt.DataSource = Posts_B.PostListTop3(); navPostRpt.DataBind(); navTaxRpt.DataSource = Taxonomy_B.TaxListTop2(); navTaxRpt.DataBind(); RptComments.DataSource = Comments_B.CommentsListTop3(); RptComments.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Posts_B.countPost() > 0) { post.Text = Posts_B.countPost().ToString() + "篇文章"; } if (Comments_B.commentCount() > 0) { comment.Text = Comments_B.commentCount().ToString() + "条评论"; } if (Taxonomy_B.TaxCount() > 0) { cate.Text = Taxonomy_B.TaxCount().ToString() + "个分类"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int order = Comments_B.CommentsList().Count(); CommentPager.RecordCount = order; Bind(); } if (!string.IsNullOrWhiteSpace(Request.QueryString["commentid"])) { if (Comments_B.delcomment(Request.QueryString["commentid"])) { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('删除成功');location.href='AdminComment.aspx';</script>"); } } }
protected void postList_ItemDataBound(object sender, RepeaterItemEventArgs e) { HiddenField cateID = e.Item.FindControl("cateID") as HiddenField; Label cateName = e.Item.FindControl("cateName") as Label; if (!string.IsNullOrWhiteSpace(cateID.Value)) { Taxonomy_M cate = Taxonomy_B.getTaxonomyByID(cateID.Value); cateName.Text = cate.TaxonomyName; } HiddenField postID = e.Item.FindControl("postID") as HiddenField; Label commentCount = e.Item.FindControl("commentCount") as Label; if (!string.IsNullOrWhiteSpace(postID.Value)) { int count = Comments_B.commentCountByPostID(postID.Value); commentCount.Text = count.ToString() + "条评论"; } }
void Bind() { CommentList.DataSource = Comments_B.CommentsListPager(CommentPager.PageSize.ToString(), CommentPager.CurrentPageIndex.ToString()); CommentList.DataBind(); }