First, some minor notes:
Page 27. First paragraph in italics references property EmptyZoneText
Throughout the book (pages 80, 82, 83, 84, 86, 88 and so on) name of type HtmlTextWriter is written as HTMLTextWriter (and enumeration HtmlTextWriterTag as HTMLTextWriterTag). I think it is better to use correct name. And on page 276 (last code block) C# variant of Render() method has type of parameter HTMLTextWriter instead of HtmlTextWriter which causes compilation error.
Pages 82 (second code block) and 83 (first code block):
Misprint: C# variants of Render() method contain “&” characters as concatenation operator instead of “+” (<img/> element generation).
Page 85. Last paragraph:
Property ChildControlsCreated referenced as ChildControlsRendered and method CreateChildControls() as
And now more involved question:
Page 85. Section Combining Controls and HTML
First paragraph states:
quote:It is possible to break your text generation down into finer parts by overriding the custom control’s other
Render* methods. These methods are automatically run by the base Render method in the WebControl
As far as I understand it means that Render* methods (which were previously defined as Render, RenderControl, RenderChildren) other than Render (i.e. RenderControl and RenderChildren) are called by Render method. And Figure 3.8 has Render method at the root of the tree structure.
But I think if we are talking about WebControl class it is not true. RenderControl is public while Render is protected and it is RenderControl method that allows a class that consumes the control to render it. And RenderControl is not run by Render method. Quite the opposite.
WebControl.RenderContents method calls Control.Render method which in turn calls Control.RenderChildren. It is where (or more precisely in RenderChildrenInternal in .NET Framework 2.0) we have RenderControl method called to render child controls of our control. And if we are talking about containing control for our current WebControl so it is RenderControl method which is called to render it and it is RenderControl which should be at the root of the tree structure.
And further on page 88 there is a paragraph:
quote:The RenderBeginTag, RenderContents, and RenderEndTag methods are not called
directly from the Render method. Instead, they are called from the RenderControl
method, which is called from the Render method. So, in order to use these methods
you must not override either the Render or RenderControl methods.
But RenderBeginTag, RenderContents, and RenderEndTag are called
from WebControl.Render method, not from RenderControl. And once again Control.RenderControl is not called
from the Control.Render method.
Sorry if I am wrong.