There seems to be a limit on the number of nested tables in browsers, I think.
IE stops at 25, FireFox stops at 31.
Place the following in a webform in Visual Studio, after the @Page directive:
In the codebehind,Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 80px" runat="server" Text="Button"></asp:Button> <asp:PlaceHolder id="phTables" runat="server"></asp:PlaceHolder> </form> </body> </HTML>
Now, run the page, click on the button.Code:private void Button1_Click(object sender, System.EventArgs e) { this.phTables.Controls.Add(AddHTMLTableControl(50)); } private Table AddHTMLTableControl(int level) { Table t = new Table(); t.Width = Unit.Percentage(100); t.Height = Unit.Point(100); t.BorderWidth = 1; TableRow tr = new TableRow(); TableCell tc = new TableCell(); tr.Cells.Add(tc); t.Rows.Add(tr); for (int i = 0; i < level; i++) { Table t1 = new Table(); t1.Width = Unit.Percentage(100); t1.Height = Unit.Point(100); t1.BorderWidth = 1; TableRow tr1 = new TableRow(); TableCell tc1 = new TableCell(); Label lbl = new Label(); lbl.Text = "level" + i; // lbl.Width = 26; tc1.Controls.Add(lbl); tr1.Cells.Add(tc1); t1.Rows.Add(tr1); tc.Controls.Add(t1); tc = tc1; } return t; }
Why the limit?




Reply With Quote