Пример #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            panelPosts.Controls.Clear();

            if (!string.IsNullOrWhiteSpace(txtTag.Text))
            {
                lblNoPostsFound.Visible = false;

                var i = 1;
                foreach (Reply post in _logic.GetPostsByTag(txtTag.Text.ToLower()))
                {
                    if (post.Visible && i <= 5 && post.MainPostID == 0)
                    {
                        panelPosts.RowCount += 1;
                        panelPosts.Controls.Add(new PostFeed(post, _event, _user, false), 0, i);
                        ++i;
                    }
                }

                // if no posts are added to panel show no posts found label
                if (i == 1)
                {
                    lblNoPostsFound.Visible = true;
                }
            }
            else
            {
                panelPosts.Controls.Clear();
                lblNoPostsFound.Visible = true;
            }
        }