| 1 | public class table |
| 2 | Inherits System.Web.UI.Page |
| 3 | protected WithEvents Alliance1 as DPM.Alliance |
| 4 | protected WithEvents Alliance2 as DPM.Alliance |
| 5 | protected WithEvents Table1 as System.Web.UI.HtmlControls.HtmlTable |
| 6 | |
| 7 | private Sub Page_Load(ByVal sender as System.object, ByVal e as System.EventArgs) Handles MyBase.Load |
| 8 | 'declare holders for the rows and cells you are going to create |
| 9 | Dim r as System.Web.UI.HtmlControls.HtmlTableRow |
| 10 | Dim c as System.Web.UI.HtmlControls.HtmlTableCell |
| 11 | |
| 12 | 'all the tables attribute are available to be set |
| 13 | 'through the tables object |
| 14 | Table1.Border = 1 |
| 15 | Table1.Width = "50%" |
| 16 | |
| 17 | 'creare a new row |
| 18 | r = new System.Web.UI.HtmlControls.HtmlTableRow() |
| 19 | 'create a new cell |
| 20 | c = new System.Web.UI.HtmlControls.HtmlTableCell() |
| 21 | |
| 22 | 'all the cells attribute are available to be set |
| 23 | 'through the tables object |
| 24 | c.ColSpan = 2 |
| 25 | c.Align = "center" |
| 26 | c.BgColor = "silver" |
| 27 | c.InnerText = "Server Created Table" |
| 28 | |
| 29 | 'add the new cell to the row |
| 30 | r.Cells.Add(c) |
| 31 | |
| 32 | 'add the new row to the table |
| 33 | Table1.Rows.Add(r) |
| 34 | |
| 35 | 'a loop to create a sample table |
| 36 | Dim i as Integer |
| 37 | for i = 0 To 10 |
| 38 | r = new System.Web.UI.HtmlControls.HtmlTableRow() |
| 39 | |
| 40 | 'all the rows attribute are available to be set |
| 41 | 'through the tables object |
| 42 | r.BgColor = &H999999 + (i * 1024) ' set the color to something |
| 43 | |
| 44 | c = new System.Web.UI.HtmlControls.HtmlTableCell() |
| 45 | c.InnerText = i.ToString |
| 46 | r.Cells.Add(c) |
| 47 | c = new System.Web.UI.HtmlControls.HtmlTableCell() |
| 48 | c.InnerText = "this is row " + i.ToString |
| 49 | r.Cells.Add(c) |
| 50 | Table1.Rows.Add(r) |
| 51 | Next |
| 52 | |
| 53 | End Sub |
| 54 | |
| 55 | private Sub InitializeComponent() |
| 56 | |
| 57 | End Sub |
| 58 | End class |