Dưới đây là một số mẫu mã mà tạo ra một thead, tbody và TFooter.
Bạn có thể về cơ bản luôn luôn sử dụng các đối tượng TableRow chỉ reset các TableSection tài sản.
Table table = new System.Web.UI.WebControls.Table();
TableRow tableRow;
TableCell tableCell;
tableRow = new TableRow();
tableRow.TableSection = TableRowSection.TableHeader;
tableCell = new TableCell();
tableCell.Text = "HEADER";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
tableRow = new TableRow();
tableRow.TableSection = TableRowSection.TableBody;
tableCell = new TableCell();
tableCell.Text = "BODY";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
tableRow = new TableRow();
tableRow.TableSection = TableRowSection.TableFooter;
tableCell = new TableCell();
tableCell.Text = "FOOTER";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
plhTest.Controls.Add(table);
Mặc dù tôi sẽ đề nghị xây dựng bảng trong html trực tiếp và phụ trang.
Nguồn
2009-08-26 18:50:52
Bằng cách nào đó tôi đọc đó là "chuỗi" và nó hoàn toàn không có ý nghĩa. Xin lỗi vì sự gián đoạn. –
Tương tự! (15 ký tự khó chịu để chiếm không gian) – Jagd