private PageView BuildPageViewContents(int cId, int group) { PageView pageView = new PageView(); string strCate = CateParentIDArray(cId); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); DataTable table = newsGroupBSO.GetNewsGroupByCateAll(strCate, group); DataTable table1 = table.Clone(); DataTable table2 = table.Clone(); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { if (i == 0) table1.ImportRow(table.Rows[i]); else if (i > 0 && i < 10) table2.ImportRow(table.Rows[i]); else break; } DataRow dataRow = table1.Rows[0]; //HtmlTable HtmlTable htmlTable = new HtmlTable(); htmlTable.Style.Value = "tab_Border_doc"; htmlTable.CellPadding = 5; //Khoi tao 1 hang HtmlTableRow htmlRow = new HtmlTableRow(); //Them dieu khien vao Cot thu 1 HtmlTableCell htmlCell = new HtmlTableCell(); htmlCell.VAlign = "top"; htmlCell.Width = "100%"; htmlCell.Align = "justify"; Literal lit_img = new Literal(); if (dataRow["ImageThumb"].ToString() != "") lit_img.Text = @"<a href='" + ResolveUrl("~/") + "News/" + Convert.ToString(group) + "/" + dataRow["NewsGroupID"].ToString() + "/Default.aspx'><img src='" + ResolveUrl("~/") + "Admin/Upload/NewsGroup/NewsGroupThumb/" + dataRow["ImageThumb"].ToString() + "' vspace='1' align='left' border='1' style='border-color:#cdcdcd; margin-right:5px ' width='100'></a>"; else lit_img.Text = ""; HyperLink hyp = new HyperLink(); hyp.Text = dataRow["Title"].ToString(); hyp.NavigateUrl = "~/News/" + Convert.ToString(group) + "/" + dataRow["NewsGroupID"].ToString() + "/Default.aspx"; hyp.CssClass = "tab_title_news"; //Literal liter_br = new Literal(); //liter_br.Text = @"<br/>"; Label liter = new Label(); liter.Text = "<div style='text-align:justify;padding-top:5px;margin-bottom:0px;'>" + dataRow["ShortDescribe"].ToString() + "</div>"; liter.CssClass = "tab_desc_news"; htmlCell.Controls.Add(lit_img); htmlCell.Controls.Add(hyp); // htmlCell.Controls.Add(liter_br); htmlCell.Controls.Add(liter); //Them cot1 vao hang htmlRow.Cells.Add(htmlCell); //Thêm dòng 1 vào bảng htmlTable.Rows.Add(htmlRow); //Them hàng 2 htmlRow = new HtmlTableRow(); //Them dieu khien vao cot 2 htmlCell = new HtmlTableCell(); htmlCell.VAlign = "top"; BulletedList bullet = new BulletedList(); bullet.CssClass = "tab_bullet_link"; bullet.DisplayMode = BulletedListDisplayMode.HyperLink; bullet.BulletStyle = BulletStyle.NotSet; bullet.DataSource = table2; bullet.DataTextField = "Title"; bullet.DataValueField = "NewsGroupID"; bullet.DataBind(); foreach (ListItem items in bullet.Items) { items.Value = "~/News/" + Convert.ToString(group) + "/" + items.Value + "/Default.aspx"; } htmlCell.Controls.Add(bullet); //Them cot 2 vao hang htmlRow.Cells.Add(htmlCell); //Them hang vao bang htmlTable.Rows.Add(htmlRow); //Them bang vao pageview pageView.Controls.Add(htmlTable); } return pageView; }