NET 69
The HtmlTextWriterTag enumeration is used for the
tag and the Border attribute
strings as a simplified means of specifying the correct HTML name. Many of the HtmlTextWriter
methods are overloaded to accept this enumeration and return the appropriate string value.
See the ASP.NET documentation for full details on what names are supported.
If you use the RenderBeginTag() to build your opening tag, you must remember to pair it
with a RenderEndTag() call to generate the closing tag. Fortunately, the HtmlTextWriter class is
smart enough to remember the nesting and the order of the two routines to match them up
and generate the correct closing tags. Closing our table is a direct call to RenderEndTag() with
no parameters:
// write
writer.RenderEndTag();
The rest of the RenderTable() routine uses RenderBeginTag() and RenderEndTag() in a twoloop
scenario to build the
and tags along with their content according to the size specified in the X and Y dimension fields of the control. The TableCustomControl Server Control via Control Composition The second table custom control example accomplishes the same task as the first but does not bother with getting its hands dirty with HTML rendering. It follows the lead of the table user control and builds up its control content programmatically by adding child controls such as the table and its cells.
Pages:
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|