protected void Page_Load(object sender, EventArgs e) { String id = Request.QueryString["id"]; if (!IsPostBack) { pId = id; Bindjiushu(id);//绑定 BindMessage(id); } else { if (Session["Userinfo"] == null) { Response.Redirect("/Users/Login.aspx"); } else { shaoqi.Model.User model = (shaoqi.Model.User)Session["Userinfo"]; shaoqi.Model.Comment messmodel = new shaoqi.Model.Comment(); shaoqi.BLL.Comment messBll = new shaoqi.BLL.Comment(); messmodel.ComContent = Request.Form["context"]; messmodel.UserId.Id = model.Id; messmodel.CartoonId.Id = Convert.ToInt32(Request.Form["Pid"]); messmodel.AddTime = DateTime.Now; messBll.Add(messmodel); BindMessage(messmodel.CartoonId.Id.ToString()); } } }
private void BindMessage(String id) { shaoqi.BLL.Comment messBll = new shaoqi.BLL.Comment(); List<shaoqi.Model.Comment> messList = new List<shaoqi.Model.Comment>(); messList = messBll.GetModelList(" CartoonId=" + id); if (messList.Count == 0) { msg = "暂时没有评论!"; } else { this.Repeater2.DataSource = messList; this.Repeater2.DataBind(); } }