コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Comment comment = new Comment();

            comment.NameUser   = Request.Form["nam"];
            comment.StrComment = Request.Form["com"];
            if ((comment.NameUser != "") && (comment.StrComment != ""))
            {
                RepositoryOfComments.GetRepository().AddComment(comment);
            }
            GetComments();
        }
コード例 #2
0
        protected void GetComments()
        {
            StringBuilder html = new StringBuilder();
            var           Data = RepositoryOfComments.GetRepository().GetAllComments();

            foreach (var com in Data)
            {
                Panel1.Controls.Add(new Label()
                {
                    Text = '-' + com.NameUser, CssClass = "LabelName"
                });
                Panel1.Controls.Add(new Panel());
                Panel1.Controls.Add(new Label()
                {
                    Text = com.StrComment, CssClass = "LabelStrComment"
                });
                Panel1.Controls.Add(new Panel());
            }
        }