private void LoadSites() { int countCells = 1; if(IsSitePage) { countCells = 2; } HtmlTableRow row = new HtmlTableRow(); Site s = new Site(); int index = 0; if (s.LoadBySiteTypeID(SiteTypeID)) { do { if (row.Cells.Count < countCells) { row.Cells.Add(AddSiteCellInnerHTML(s.s_Name, s.s_Banner, s.s_URL)); } else { tblSites.Rows.Add(row); row = new HtmlTableRow(); row.Cells.Add(AddSiteCellInnerHTML(s.s_Name, s.s_Banner, s.s_URL)); } if (!IsSitePage && index >= 5) { break; } index++; } while (s.MoveNext()); } for (int i = row.Cells.Count; i < countCells; i++) { row.Cells.Add(AddTableCell(" ")); } tblSites.Rows.Add(row); }