コード例 #1
0
 /// <summary>
 /// Render list of post preview control based on the posts property
 /// </summary>
 private void Render()
 {
     if (Comments != null && Comments.Count > 0)
     {
         foreach (var comment in Comments)
         {
             CommentBox control = (CommentBox)Page.LoadControl("~\\UserControl\\CommentBox.ascx");
             control.Comment = comment;
             PlaceHolder1.Controls.Add(control);
         }
     }
 }
コード例 #2
0
        private void Render()
        {
            fcommentId.Value  = Comment.CommentId.ToString();
            fuserId.Value     = Comment.UserId.ToString();
            fpostId.Value     = Comment.PostId.ToString();
            lblAuthor.Text    = Comment.Users.Username;
            lblCreatedAt.Text = Comment.CreatedAt.ToString();
            //lblContent.Text = Comment.Content;
            List <Comment> replies = Comment.Children;

            if (replies != null && replies.Count > 0)
            {
                foreach (var reply in replies)
                {
                    CommentBox control = (CommentBox)Page.LoadControl("~\\UserControl\\CommentBox.ascx");
                    control.Comment = reply;
                    PlaceHolder1.Controls.Add(control);
                }
            }
        }