Example #1
0
        private void populateTable()
        {
            allPostsByUser = BlogPosts.getAllBlogPostsByUserID(Request.QueryString["blogOwner"]);
            int i = 0;

            foreach (BlogPosts bp in allPostsByUser)
            {
                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Text  = "" + bp.Date.ToString().Substring(0, 10);
                cell.Width = new Unit(50);
                row.Cells.Add(cell);

                cell       = new TableCell();
                cell.Text  = "" + bp.Time;
                cell.Width = new Unit(50);
                row.Cells.Add(cell);

                cell       = new TableCell();
                cell.Text  = "" + bp.PostContent;
                cell.Width = new Unit(400);
                row.Cells.Add(cell);

                // Set Row colours
                if (i % 2 == 0)
                {
                    row.BackColor = Color.FromArgb(161, 178, 195);
                }
                else
                {
                    row.BackColor = Color.WhiteSmoke;
                }
                i++;

                blogHistoryTable.Rows.Add(row);
            }
            blogHistoryTable.GridLines = GridLines.Both;
        }