protected void btnCommit_ServerClick(object sender, EventArgs e) { int aid = Convert.ToInt32(Request.QueryString["aid"]); CommentOperate cp = new CommentOperate(); string comment = Server.HtmlEncode(this.txtComment.Text.ToString()); if (comment.Length > 250) { comment = comment.Substring(0, 250); } Comment ct = new Comment(aid, comment); bool b = cp.insert(ct); if (b) { this.lblErrorComment.Visible = false; this.DataListAllComment.DataBind(); Response.Redirect("article.aspx?aid=" + aid); } else { this.lblErrorComment.Visible = true; this.lblErrorComment.Text = "评论发表失败,请重新尝试!"; } }
protected void summit_Btn_Click(object sender, EventArgs e) { CommentOperate cop = new CommentOperate(); Comment co = new Comment(); co.gid = Request.QueryString["id"].ToString(); co.gcontent = FCKeditor1.Value; co.gauthor = tb_author.Text; bool flag = cop.insert(co); if (flag) { id = Request.QueryString["id"].ToString(); at = aot.getByAid(id); at.gentieCount++; aot.update(at);//跟帖次数加一后修改 this.DataListAllComment.DataBind(); this.Label1.Visible = false; Response.Redirect("newsarticle.aspx?id=" + id); } else { Label1.Text = "发贴失败!"; } }