protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(Request.QueryString["TaxID"])) { string TaxID = Request.QueryString["TaxID"]; Taxonomy_M tax = Taxonomy_B.getTaxonomyByID(TaxID); txtTax.Text = tax.TaxonomyName; rptPostList.DataSource = Posts_B.PostListByTaxID(TaxID); rptPostList.DataBind(); } }
protected void rptPostList_ItemDataBound(object sender, RepeaterItemEventArgs e) { HiddenField categoryID = e.Item.FindControl("CategoryID") as HiddenField; LinkButton CategoryName = e.Item.FindControl("CategoryName") as LinkButton; if (!string.IsNullOrWhiteSpace(categoryID.Value)) { Taxonomy_M tax = Taxonomy_B.getTaxonomyByID(categoryID.Value); CategoryName.Text = tax.TaxonomyName; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrWhiteSpace(Request.QueryString["taxId"])) { Taxonomy_M tax = Taxonomy_B.getTaxonomyByID(Request.QueryString["taxId"]); txtTaxName.Text = tax.TaxonomyName; txtTaxDesc.Text = tax.Taxonomydesc; btnaddTax.Text = "编辑分类"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(Request.QueryString["PostId"])) { Posts_M Post = Posts_B.PostByID(Request.QueryString["PostId"]); Page.Title = Post.Title; lblTitle.Text = Post.Title; PostDesc.Text = Post.Post; PublishTime.Text = Post.PublishTime.ToShortDateString(); int CategoryId = Post.TaxonomyId; CategoryName.Text = Taxonomy_B.getTaxonomyByID(CategoryId.ToString()).TaxonomyName; } else { Response.Redirect("Index.aspx"); } }
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() + "条评论"; } }