当前路径:AjaxMyPage/UI/guestbook.aspx.cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; using Model; public partial class UI_guestbook : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.panHead.Attributes.Add("onmousedown", "Mdown()"); this.panHead.Attributes.Add("onmouseup", "Mup()"); page(); } } #region 分页 protected void page() { PagedDataSource pds=new PagedDataSource (); pds.DataSource = (new InterGuestbook()).getListGuestBook(); pds.AllowPaging = true; pds.PageSize = 3; lblTotalNum.Text ="/"+pds.PageCount.ToString()+" page"; pds.CurrentPageIndex = int.Parse (lblCurrent .Text)-1 ; lbtnBack.CommandArgument = lblCurrent.Text; if (pds.IsFirstPage) { ibtnPrev.Visible = false ; ibtnNext.Visible = true; } if (pds.IsLastPage) { ibtnNext.Visible = false; ibtnPrev.Visible = true; } if (pds.IsFirstPage && pds.IsLastPage) { ibtnNext.Visible = false; ibtnPrev.Visible = false; } if (!pds.IsLastPage && !pds.IsFirstPage) { ibtnNext.Visible = true; ibtnPrev.Visible = true; } this.dlLy.DataSource = pds; this.dlLy.DataBind(); } #endregion protected void ibtnNext_Click(object sender, ImageClickEventArgs e) { lblCurrent.Text = Convert.ToString(int.Parse(lblCurrent.Text) + 1); page(); } protected void ibtnPrev_Click(object sender, ImageClickEventArgs e) { lblCurrent.Text = Convert.ToString(int.Parse(lblCurrent.Text) - 1); page(); } /// <summary> /// 发送留言 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSend_Click(object sender, EventArgs e) { InterGuestbook addLy = new InterGuestbook(); string picPath = Request.Form["bookface"].ToString(); addLy.setGuestBook(txtName.Text, txtEmail.Text, txtCommend.Text, picPath); lblCurrent.Text = "1"; panPage.Visible = true;//显示留言列表 PanManage.Visible = false;//隐藏单条留言 panOpenWindow.Visible = false;//隐藏回复留言 this.lbtnBack.Text = "留言本"; page(); } /// <summary> /// 显示单条留言内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Command(object sender, CommandEventArgs e) { if (e.CommandName == "lbtnContent") { this.panPage .Visible = false;//隐藏留言列表 this.PanManage .Visible = true ;//显示单条留言 this.lbtnBack.Text = "返回"; InterGuestbook getLy = new InterGuestbook(); guestbook[] gb = getLy.only(e.CommandArgument.ToString()); this.Repeater1.DataSource = gb; this.DataBind(); this.lbtnDel.CommandArgument = e.CommandArgument.ToString(); this.lbtnRecontent.CommandArgument = e.CommandArgument.ToString(); } } /// <summary> /// 返回留言列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnBack_Click(object sender, EventArgs e) { lblCurrent.Text = lbtnBack.CommandArgument; this.lbtnBack.Text = "留言本"; this.panOpenWindow.Visible = false ; this.PanManage .Visible = false; this.panPage .Visible = true ; page(); } /// <summary> /// 显示回复留言 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnRecontent_Click1(object sender, EventArgs e) { InterGuestbook getLy = new InterGuestbook(); guestbook[] gb = getLy.only(lbtnRecontent.CommandArgument); this.TextBox1.Text = gb[0].Recontent; this.panOpenWindow.Visible = true; } /// <summary> /// 发送回复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { panOpenWindow.Visible = false; InterGuestbook igb = new InterGuestbook(); igb.setReGuestBook(this.TextBox1.Text, lbtnRecontent.CommandArgument); bidnRpt(); } /// <summary> /// 绑定单条留言内容 /// </summary> private void bidnRpt() { InterGuestbook getLy = new InterGuestbook(); guestbook[] gb = getLy.only(lbtnRecontent.CommandArgument); this.Repeater1.DataSource = gb; this.DataBind(); } /// <summary> /// 删除留言 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnDel_Click(object sender, EventArgs e) { this.panOpenWindow.Visible = false; InterGuestbook delLy = new InterGuestbook(); if (!delLy.delGuestBook(lbtnDel.CommandArgument)) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('删除失败!');", true); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('删除成功!');", true); lblCurrent.Text = lbtnBack.CommandArgument; this.lbtnBack.Text = "留言本"; this.PanManage.Visible = false; this.panPage.Visible = true; page(); } } }
相关源码
- HTML5响应式在线教育培训类企业商学院整站系统2020-10-21
- 图书管理系统2020-10-17
- 开单大师学习版2020-09-02
- 花语花店销售网站源码2020-08-03
- LONE网上购书源码2020-08-01
- 开单大师学习版源码2020-07-21
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途) 企业QQ:2852517674
地址:北京市海淀区中关村鼎好大厦A座二层 邮编:100080
Room A-801,Dinghao Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2015. 京ICP备09089570号 | 京公网安备11010702000869号
联系电话(Tel):4008-010-151(免长途) 企业QQ:2852517674
地址:北京市海淀区中关村鼎好大厦A座二层 邮编:100080
Room A-801,Dinghao Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2015. 京ICP备09089570号 | 京公网安备11010702000869号