Admin.Posts.AddEntry.BindCategories C# (CSharp) Method

BindCategories() private method

The bind categories.
private BindCategories ( Guid postId ) : void
postId Guid
return void
        private void BindCategories(Guid postId)
        {
            string catHtml = "";
            var post = postId == Guid.Empty ? null : Post.GetPost(postId);

            foreach (var cat in Category.Categories)
            {
                string chk = "";
                if(post != null && post.Categories.Contains(cat))
                    chk = "checked=\"checked\"";

                catHtml += string.Format("<input type=\"checkbox\" {0} id=\"{1}\">", chk, cat.Id);
                catHtml += string.Format("<label>{0}</label><br/>", Server.HtmlEncode(cat.Title));
            }
            cblCategories.InnerHtml = catHtml;
        }