protected void BingTC() { int topic_id = Convert.ToInt32(Request.QueryString["top_id"].ToString()); DataTable tc = Topic_CommentManager.pltop(topic_id); if (tc != null) { ListView1.DataSource = tc; ListView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { BindView(); string tcid; if (!IsPostBack) { try { if (Request.QueryString["tc_id"] != null) { tcid = Request.QueryString["tc_id"].ToString(); Topic_CommentManager.delete(tcid); BindView(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } }
protected void plfabu_Click(object sender, EventArgs e) { Button bt = (Button)sender; if (Session["user_name"] != null) { try { Topic_Comment tc = new Topic_Comment(); tc.Tc_user_id1 = int.Parse(Session["user_id"].ToString()); tc.Tc_top_id1 = Convert.ToInt32(Request.QueryString["Top_id"].ToString()); tc.Tc_mess1 = plshuru.Text; tc.Tc_time1 = DateTime.Now; if (Topic_CommentManager.topic_comment(tc) == 1) { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('回复成功');</script>"); plshuru.Text = ""; BingTC(); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('评论失败');</script>"); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('请先登录!');</script>"); } }
protected void BindView() { ListView1.DataSource = Topic_CommentManager.admin_tc(); ListView1.DataBind(); }