protected void Page_Load(object sender, EventArgs e) { //url = "admin/editpage.aspx?id=" + Request.QueryString["id"].ToString(); if (!IsPostBack) { try { id = Request.QueryString["id"].ToString(); ii = id; Url = "admin/editpage.aspx?id=" + id; Durl = "admin/deletepage.aspx?id=" + id; at = aot.getByAid(id); if (at == null || at.Equals(null)) { this.Page.Title = "此文章不存在" + " " + Title; this.lblcontent.Text = "此文章不存在!"; } else { this.lbltitle.Text = at.title; this.Page.Title = at.title + " " + Title; this.lblposttime.Text = at.postdatetime.ToString(); this.Lbl_readcount.Text = at.readcount.ToString(); this.lblcontent.Text = at.content; this.lblcname.Text = at.author; this.lblCommet.Text = at.gentieCount.ToString(); CommentOperate cop = new CommentOperate(); this.DataListAllComment.DataSource = cop.viewAllbyAid(id); this.DataListAllComment.DataBind(); at.readcount++; aot.update(at); } } catch { // Response.Write("文章不存在!"); } } }
protected void Page_Load(object sender, EventArgs e) { try { string id = Request.QueryString["artid"].ToString(); string Sid = Request.QueryString["id"].ToString(); Article ar = new Article(); ArticleOperate ao = new ArticleOperate(); ar = ao.getByAid(id); ar.gentieCount--; ao.update(ar); CommentOperate co = new CommentOperate(); bool b = co.delete(Sid); if (b) { Response.Redirect("~/newsarticle.aspx?id=" + id); } } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { string id = Request.QueryString["artid"].ToString(); string Sid = Request.QueryString["id"].ToString(); Article ar = new Article(); ArticleOperate ao = new ArticleOperate(); ar = ao.getByAid(id); ar.gentieCount--; ao.update(ar); CommentOperate co = new CommentOperate(); bool b = co.delete(Sid); if (b) { Response.Redirect("~/newsarticle.aspx?id="+id); } } catch { } }