The HtmlGenericControl??™s InnerHtml, or content, is then set to the X and Y
values for the cell. The result is that the
tag is nested in the table cell??™s tag. The final step in the process is to add the cell to its parent row: content = new HtmlGenericControl("SPAN"); content.InnerHtml = "X:" + x.ToString() + "Y:" + y.ToString(); cell.Controls.Add(content); row.Cells.Add(cell); The HTML rendered in the browser client shows the direct insertion of the CSS attributes into the | tag and the HtmlGenericControl production of the content:
| X:0Y:0
| Figure 1-10 shows the output of all this work. When the page initially loads, the red and
yellow table is not present. Once values are entered for X and Y, in this case 3 and 3, clicking the
Build Table button results in the page shown in Figure 1-10.
Figure 1-10. Output from the HTML Controls web form
20 CHAPTER 1 ?– SERVER CONTROL BASICS
The System.Web.UI.WebControls Namespace
Like the HTML controls in the previous section, the web controls occupy a separate namespace
in the .NET Framework??”namely, System.Web.UI.WebControls. Figure 1-11 shows the graphical
breakdown of the namespace and the myriad server control objects available.
Pages:
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72