当前位置: 首页>>代码示例>>C#>>正文


C# DataLayer.GetPost方法代码示例

本文整理汇总了C#中DataLayer.GetPost方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.GetPost方法的具体用法?C# DataLayer.GetPost怎么用?C# DataLayer.GetPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLayer的用法示例。


在下文中一共展示了DataLayer.GetPost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                admin.Visible = true;
            }
            else
            {
                admin.Visible = false;
            }
            DataLayer dl = new DataLayer();
            int iPostID = Convert.ToInt32(Request.QueryString["bid"]);
            DataTable dtPost = dl.GetPost(iPostID);
            PostTitle.InnerText = dtPost.Rows[0].ItemArray[2].ToString();
            PostDate.InnerText = Convert.ToDateTime(dtPost.Rows[0].ItemArray[1]).ToString("D");
            PostBody.InnerHtml = dtPost.Rows[0].ItemArray[3].ToString();
            DataTable dtComments = dl.GetComments(iPostID);
            commentcount.InnerText = dtComments.Rows.Count.ToString();
            foreach (DataRow dr in dtComments.Rows)
            {
                comments.Controls.Add(new LiteralControl("<div style=\"background-color:#535684;margin-bottom:5px;padding:5px;\"><table style=\"width:100%;\"><td style=\"text-align:center;vertical-align:top;font-weight:bold;width:20%;border-right:solid 3px #313462;\">"));
                if (dr.ItemArray[4].ToString() != "nosite")
                {
                    comments.Controls.Add(new LiteralControl("<a href=\"" + dr.ItemArray[4].ToString() + "\">"));
                }
                comments.Controls.Add(new LiteralControl(dr.ItemArray[2].ToString()));
                if (dr.ItemArray[4].ToString() != "nosite")
                {
                    comments.Controls.Add(new LiteralControl("</a>"));
                }
                comments.Controls.Add(new LiteralControl("</td><td style=\"vertical-align:top;padding-left:10px;width:70%;\">" + dr.ItemArray[5].ToString() + "<br /><br />" + dr.ItemArray[3].ToString()));
                if (User.Identity.IsAuthenticated)
                {
                    comments.Controls.Add(new LiteralControl("</td><td style=\"vertical-align:middle;border-left:solid 3px #313462;text-align:center;width:10%;\">"));
                    lbtnDelete = new LinkButton();
                    lbtnDelete.ID = dr.ItemArray[0].ToString();
                    lbtnDelete.Text = "X";
                    lbtnDelete.CausesValidation = false;
                    lbtnDelete.OnClientClick = "return confirm('Are you sure you want to delete this comment?');";
                    lbtnDelete.Click += new EventHandler(lbtnDelete_Click);
                    comments.Controls.Add(lbtnDelete);
                }
                comments.Controls.Add(new LiteralControl("</td></tr></table></div>"));
            }

            if (!this.IsPostBack)
            {
                Session["CaptchaImageText"] = CaptchaImage.GenerateRandomCode(random);
            }
        }
开发者ID:chevex-archived,项目名称:1PromotionalProducts,代码行数:50,代码来源:Post.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.Redirect("Default.aspx", true);
            }

            if (!this.IsPostBack)
            {
                if (Request.QueryString["bid"] != null)
                {
                    cbxDeletePost.Visible = true;
                    int iPostID = Convert.ToInt32(Request.QueryString["bid"]);
                    DataLayer dl = new DataLayer();
                    DataTable dtPost = dl.GetPost(iPostID);
                    tbxTitle.Text = dtPost.Rows[0].ItemArray[2].ToString();
                    //rteBody.Value = dtPost.Rows[0].ItemArray[3].ToString();
                }
                else
                {
                    cbxDeletePost.Visible = false;
                }
            }
        }
开发者ID:chevex-archived,项目名称:1PromotionalProducts,代码行数:24,代码来源:AddEditPost.aspx.cs


注:本文中的DataLayer.GetPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。