Пример #1
0
        private void displayPosts(List <Forum> p)
        {
            catID = Int32.Parse(Request.QueryString["catID"]);
            for (int i = 0; i < p.Count; i++)
            {
                HtmlTableRow tr = new HtmlTableRow();
                ForumCategoriesTable.Controls.Add(tr);

                HtmlTableCell      td_IMG = new HtmlTableCell();
                HtmlGenericControl img    = new HtmlGenericControl("img");
                img.Attributes.Add("src", "images/forumPosts.png");
                td_IMG.Controls.Add(img);

                HtmlTableCell      td_title = new HtmlTableCell();
                HtmlGenericControl a        = new HtmlGenericControl("a");
                a.Attributes.Add("href", "ForumMessages.aspx?catID=" + p[i].CategoryID + "&postID=" + p[i].PostID);
                a.InnerHtml = p[i].Title + " <br />";
                td_title.Controls.Add(a);
                HtmlGenericControl span = new HtmlGenericControl("span");
                span.Attributes.Add("class", "desc");
                User user = DBconnection.getUser(p[i].UserID);
                span.InnerText = user.Name;
                td_title.Controls.Add(span);

                HtmlTableCell td_Messages = new HtmlTableCell();
                td_Messages.InnerHtml = DBconnection.getNumberOfRecords("PostID_FK", p[i].PostID) + " Messages";

                tr.Controls.Add(td_IMG);
                tr.Controls.Add(td_title);
                tr.Controls.Add(td_Messages);
            }
        }
Пример #2
0
        private void displayCategories(List <Forum> c)
        {
            for (int i = 0; i < c.Count; i++)
            {
                HtmlTableRow tr = new HtmlTableRow();

                HtmlTableCell      td_IMG = new HtmlTableCell();
                HtmlGenericControl img    = new HtmlGenericControl("img");
                img.Attributes.Add("src", "images/forumCategories.png");
                td_IMG.Controls.Add(img);

                HtmlTableCell      td_title = new HtmlTableCell();
                HtmlGenericControl a        = new HtmlGenericControl("a");
                a.Attributes.Add("href", "ForumPosts.aspx?catID=" + c[i].CategoryID + "&catTitle=" + c[i].Title);
                a.InnerHtml = c[i].Title + " <br />";
                td_title.Controls.Add(a);
                HtmlGenericControl span = new HtmlGenericControl("span");
                span.Attributes.Add("class", "desc");
                span.InnerText = c[i].Text;
                td_title.Controls.Add(span);

                HtmlTableCell td_posts = new HtmlTableCell();
                td_posts.InnerHtml = DBconnection.getNumberOfRecords("ForumPosts", "CategoryID_FK", c[i].CategoryID) + " Posts";

                HtmlTableCell td_Messages = new HtmlTableCell();
                td_Messages.InnerHtml = DBconnection.getNumberOfRecords("CategoryID_FK", c[i].CategoryID) + " Messages";

                tr.Controls.Add(td_IMG);
                tr.Controls.Add(td_title);
                tr.Controls.Add(td_posts);
                tr.Controls.Add(td_Messages);



                ForumCategoriesTable.Controls.Add(tr);
            }
        }