Render vs RenderContents

A

Alex Nitulescu

Hi.

What's the difference between the Render method (overridden when creating
custom controls) and the RenderContents method.... (overridden when creating
custom controls) ?

From MSDN:

Render - Sends server control content to a provided HtmlTextWriter object,
which writes the content to be rendered on the client.
Overridable Protected Sub Render( ByVal writer As HtmlTextWriter )

RenderContents - Renders the contents of the control into the specified
writer. This method is used primarily by control developers.
Overridable Protected Sub RenderContents( ByVal writer As HtmlTextWriter )

So.... to me, it's not any clearer than before reading these "helpful"
lines. To me, they are just the same.

Thank you,
Alex.
 
M

MasterGaurav

The WebControl breaks down the "Render" method of Control method into
three parts:

1. StartingTag: RenderBeginTag
2. Content within tag: RenderControl
3. End of Tag: RenderEndTag

If you want to provide full functionality on your own, override the
Render Method.

However, if you wish to use RenderBeginTag and RenderEndTag
functionality as provided in WebControl and wish to provide only the
inner content, override RenderControl.



--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
--------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top