Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 12th, 2005, 06:05 PM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combining Controls and HTML


First, some minor notes:

Page 27. First paragraph in italics references property EmptyZoneText
as EmptyPartText.

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.

Best regards,
Alexey Gorkov
Old January 15th, 2006, 06:19 PM
Authorized User
Join Date: Dec 2005
Location: Goderich, Ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

First: My apologies for taking so long to respond. I thought that I had subscribed to this forum so that I would get all the new postings--I was obviously mistaken.

Second: thanks for catching all the typos--especially the caps on HtmlTextWriter. That's the kind of thing that can drag on through a book's history.

On the Render methods: You're right. I've got Render and RenderControl swapped around in the diagram and through this section <sigh>. The top of the heap is definitely the RenderControl method (I slapped together a test just now in the faint hope that I had gotten it right back in the book and you were wrong--no luck).

When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

- Sherlock Holmes, as recorded by Sir A. C. Doyle in "The Blanched Soldier"

Similar Threads
Thread Thread Starter Forum Replies Last Post
The html rendered by controls... philthy BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 October 23rd, 2008 04:23 PM
HTML controls g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 7 January 10th, 2006 02:14 AM
Referencing Html Controls ~Bean~ ASP.NET 1.0 and 1.1 Basics 3 September 30th, 2005 09:11 AM
HTML Controls rajanikrishna General .NET 1 November 10th, 2004 11:35 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.