protected void Page_Load(object sender, EventArgs e) { Bindncb(); int id; if (!IsPostBack) { try { if (Request.QueryString["ncbid"] != null) { id = Convert.ToInt32(Request.QueryString["ncbid"].ToString()); if (News_Comment_BackBLL.deletencb(id) == 1) { Bindncb(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>"); } } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } }
protected void listView1_ItemDataBound(object sender, ListViewItemEventArgs e) { Repeater rpt = e.Item.FindControl("Repeater2") as Repeater;//找到里层的repeate; int ncbid = Convert.ToInt32(((Label)e.Item.FindControl("Label3")).Text); rpt.DataSource = News_Comment_BackBLL.cball(ncbid); rpt.DataBind(); }
//回复 protected void huifu_Click(object sender, EventArgs e) { Button bt = (Button)sender; if (Session["username"] != null) { try { News_Comment_Back ncb = new News_Comment_Back(); ncb.CB_Content1 = (bt.Parent.FindControl("FCKeditor2") as TextBox).Text; ncb.CN_Time1 = DateTime.Now; ncb.CB_Users_Name1 = Session["username"].ToString(); ncb.CB_NC_ID1 = Int32.Parse((bt.Parent.FindControl("HiddenField1") as HiddenField).Value); if (News_Comment_BackBLL.cbadd(ncb) == 1) { FCKeditor1.Text = ""; ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论成功!');", true); flag = true; BingNC(); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论失败!');", true); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,请先登录!');", true); } }
//绑定数据 protected void Bindncb() { ListView1.DataSource = News_Comment_BackBLL.allncb(); ListView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //新闻评论回复删除操作 int id; if (!IsPostBack) { try { if (Request.QueryString["ncid"] != null) { id = Convert.ToInt32(Request.QueryString["ncid"].ToString()); if (News_CommentaryBll.news_deletenc(id) == 1) { loginover.Visible = true; shuju.Visible = true; newscomment.Visible = true; Bindnc(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>"); } } if (Request.QueryString["ncbid"] != null) { id = Convert.ToInt32(Request.QueryString["ncbid"].ToString()); if (News_Comment_BackBLL.deletencb(id) == 1) { loginover.Visible = true; shuju.Visible = true; newscommentback.Visible = true; Bindncb(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>"); } } if (Request.QueryString["bbsid"] != null) { id = Convert.ToInt32(Request.QueryString["bbsid"].ToString()); if (BBSBll.deletebbs(id) == 1) { loginover.Visible = true; shuju.Visible = true; userbbs.Visible = true; Bindbbs(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除失败!');</script>"); } } if (Request.QueryString["bcid"] != null) { id = Convert.ToInt32(Request.QueryString["bcid"].ToString()); if (BBS_CommentBll.deletebc(id) == 1) { loginover.Visible = true; shuju.Visible = true; bbscomment.Visible = true; Bindnbc(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>"); } } if (Request.QueryString["bcbid"] != null) { id = Convert.ToInt32(Request.QueryString["bcbid"].ToString()); if (BBS_Comment_BackBll.deletebcb(id) == 1) { loginover.Visible = true; shuju.Visible = true; bbscomentback.Visible = true; Bindnbcb(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>"); } } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } if (Session["username"] != null) { login.Visible = false; loginover.Visible = true; //如果用户名不为空,将用户信息绑定 SqlDataReader dt = UsersBll.select(Session["username"].ToString()); dt.Read(); Img.ImageUrl = dt[5].ToString(); name.Text = dt[1].ToString(); password.Text = dt[2].ToString(); password1.Text = dt[2].ToString(); Phone.Text = dt[3].ToString(); Sex.Text = dt[4].ToString(); } else { login.Visible = true; loginover.Visible = false; } if (loginover.Visible == true) { updateuser.Visible = true; //根据页面传值显示不同的数据 if (Request.QueryString["bbs"] != null || Request.QueryString["news"] != null || Request.QueryString["back"] != null) { updateuser.Visible = false; shuju.Visible = true; //新闻评论 if (Request.QueryString["news"] == "nc") { newscomment.Visible = true; Bindnc(); } //新闻评论回复 if (Request.QueryString["news"] == "ncb") { newscommentback.Visible = true; Bindncb(); } //发布帖子 if (Request.QueryString["bbs"] == "bbs") { userbbs.Visible = true; Bindbbs(); } //发布帖子下的评论 if (Request.QueryString["bbs"] == "bc") { bbscomment.Visible = true; Bindnbc(); } //发布帖子下评论的回复 if (Request.QueryString["bbs"] == "bcb") { bbscomentback.Visible = true; Bindnbcb(); } if (Request.QueryString["back"] == "bbs") { backbbs.Visible = true; Bindnbcb(); } } } }