Exemple #1
0
 protected void btnCommit_ServerClick(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string sex = "1";
         if (this.rbtnNv.Checked)
         {
             sex = "2";
         }
         string pcontent = this.txtPcontent.Text;
         if (pcontent.Length > 500)
         {
             pcontent = pcontent.Substring(0, 500);
         }
         PopOperate po = new PopOperate();
         Pop        op = new Pop(Server.HtmlEncode(this.txtPname.Text), Server.HtmlEncode(pcontent), sex);
         if (po.insert(op))
         {
             Response.Redirect("pop.aspx");
         }
         else
         {
             this.lblErrorComment.Text = "发表失败";
         }
     }
 }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.Title = Title + SetTitle.getTitle();
         int currentPage;
         try {
             currentPage = Convert.ToInt32(Request.QueryString["p"]);
         }
         catch {
             currentPage = 1;
         }
         if (currentPage == 0)
         {
             currentPage = 1;
         }
         PagedDataSource ps = new PagedDataSource();
         PopOperate      op = new PopOperate();
         ps.DataSource                = op.viewAll();
         ps.AllowPaging               = true;
         ps.CurrentPageIndex          = currentPage - 1;
         ps.PageSize                  = 6;
         this.Pagination1.pageCount   = ps.PageCount;
         this.Pagination1.currentPage = currentPage;
         this.Pagination1.pageUrl     = "pop.aspx";
         this.Pagination1.paramName   = "p";
         this.DataListPop.DataSource  = ps;
         this.DataListPop.DataBind();
     }
 }
Exemple #3
0
    protected void btnCommit_ServerClick(object sender, EventArgs e)
    {
        int pid = Convert.ToInt32(Request.QueryString["p"]);
        ClientScriptManager cs = this.ClientScript;
        Pop p = new Pop();

        p.pid      = pid;
        p.adminrev = this.txtPopRev.Text;
        PopOperate po = new PopOperate();
        bool       b  = po.update(p);

        if (b)
        {
            Response.Redirect("~/pop.aspx");
        }
        else
        {
            this.lblErrorComment.Text = "回复出错,请重新尝试";
        }
    }