Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //asdfasdfasdfasdfaasddf
        if (!IsPostBack)
        {
            this.Title = SetTitle.getTitle();
            try
            {
                int     aid = Convert.ToInt32(Request.QueryString["aid"]);
                Article at  = (new ArticleOperate()).getByAid(aid);
                if (at == null || at.Equals(null))
                {
                    this.Page.Title      = "此文章不存在,或被管理员删除,请见谅" + " " + Title;
                    this.lblcontent.Text = "此文章不存在,或被管理员删除,请见谅!";

                    this.txtComment.Text         = "此文章不存在,不允许发表评论";
                    this.txtComment.Enabled      = false;
                    this.btnCommit.EnableTheming = false;
                }
                else
                {
                    this.lbltitle.Text             = at.title;
                    this.Page.Title                = at.title + " " + Title;
                    this.lblposttime.Text          = at.posttime.ToString();
                    this.lblcontent.Text           = at.content;
                    this.lblcname.Text             = at.cname;
                    this.hklist.NavigateUrl        = "list.aspx?cid=" + at.cid.ToString();
                    this.hklastArticle.NavigateUrl = "article.aspx?aid=" + (at.aid - 1).ToString();
                    this.hknextArticle.NavigateUrl = "article.aspx?aid=" + (at.aid + 1).ToString();
                    this.lblCommet.Text            = at.countcomment.ToString();
                    CommentOperate cop = new CommentOperate();
                    this.DataListAllComment.DataSource = cop.viewAllbyAid(aid);
                    this.DataListAllComment.DataBind();
                }
            }
            catch
            {
                Response.Redirect("refresh.aspx?msg=" + "此文章不存在,或被管理员删除,请见谅!");
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //url = "admin/editpage.aspx?id=" + Request.QueryString["id"].ToString();
        if (!IsPostBack)
        {
            try
            {
                id   = Request.QueryString["id"].ToString();
                ii   = id;
                Url  = "admin/editpage.aspx?id=" + id;
                Durl = "admin/deletepage.aspx?id=" + id;
                at   = aot.getByAid(id);

                if (at == null || at.Equals(null))
                {
                    this.Page.Title      = "此文章不存在" + " " + Title;
                    this.lblcontent.Text = "此文章不存在!";
                }
                else
                {
                    this.lbltitle.Text      = at.title;
                    this.Page.Title         = at.title + " " + Title;
                    this.lblposttime.Text   = at.postdatetime.ToString();
                    this.Lbl_readcount.Text = at.readcount.ToString();
                    this.lblcontent.Text    = at.content;
                    this.lblcname.Text      = at.author;
                    this.lblCommet.Text     = at.gentieCount.ToString();
                    CommentOperate cop = new CommentOperate();
                    this.DataListAllComment.DataSource = cop.viewAllbyAid(id);
                    this.DataListAllComment.DataBind();
                    at.readcount++;
                    aot.update(at);
                }
            }
            catch
            {
                // Response.Write("文章不存在!");
            }
        }
    }