protected void BingUserMess() { UserMess um = new UserMess(); DataListUserMess.DataSource = um.GetUserMess(); DataListUserMess.DataKeyField = "Id"; DataListUserMess.DataBind(); }
protected void btnCreateItem_Click(object sender, EventArgs e) { //回复留言 UserMess um = new UserMess(); if (um.ReplyMessById(Request.Params["id"], replycnt.Text) > 0) { Response.Write("<script>alert('回复成功!');location.href='UserMessage.aspx';</script>"); } }
protected void ButtonFaBiao_Click(object sender, EventArgs e) { string txtName = Server.HtmlEncode(UserName.Value); string txtContent = MessText.Value; UserMess mess = new UserMess(); UserMessInfo info = new UserMessInfo(txtName, txtContent, DateTime.Now.ToString()); if (Page.IsValid) { mess.InsertMess(info); } //PsPageData(); Response.Redirect("MessWord.aspx"); }
private void BindData(string id) { UserMess um = new UserMess(); UserMessInfo umi = um.GetUserMessById(id); if (umi == null) { Response.Redirect("UserMessage.aspx"); } else { lbName.Text = umi.Name; lbContent.Text = ReImg(umi.Content); lbTime.Text = umi.DateTim; replycnt.Text = umi.Reply == null ? "" : umi.Reply; } }
//分页 protected PagedDataSource PsPageData() { UserMess dll = new UserMess(); PagedDataSource ps = new PagedDataSource(); ps.DataSource = dll.GetUserMess(); ps.AllowPaging = true; ps.PageSize = 10; string txtPa = Request.QueryString["page"]; string txtCurrent = string.Empty; if (txtPa != null) { ps.CurrentPageIndex = Convert.ToInt32(txtPa) - 1; } else { ps.CurrentPageIndex = 0; } RepeaterCategory.DataSource = ps; RepeaterCategory.DataBind(); return(ps); }