private void LoadGianHang() { CuaHang ch = new CuaHang(); DataSet ds = ch.SelectCuaHangAtViTriCuaHang(1); int n = ds.Tables[0].Rows.Count; for (int j = 0; j < 4; j++) { TableRow tr = new TableRow(); for (int i = 0; i < 4; i++) { TableCell td = new TableCell(); string content = ""; if (j*4 + i < n) { content += "<table width=\"100%\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">"; content += "<tr><td><a href=\"estore.aspx?sid=" + ds.Tables[0].Rows[j*4 + i]["CuaHangID"] + "\"><img src=\"" + ds.Tables[0].Rows[j*4 + i]["Anh"] + "\" width=\"110\" height=\"73\" style=\"border:#ece2a4 1px solid\" /></a></td>"; content += "<td><a href=\"estore.aspx?sid=" + ds.Tables[0].Rows[j*4 + i]["CuaHangID"] + "\"><b>" + ds.Tables[0].Rows[j*4 + i]["TenCuaHang"] + "</b></a></td></tr></table>"; } td.Text = content; td.HorizontalAlign = HorizontalAlign.Left; if (j == 0) td.Width = Unit.Percentage(25); tr.Cells.Add(td); } tblGianHang.Rows.Add(tr); } }