Adding Literal Controls in CreateChildControls - Is this bad?

K

KJ

Adding Literal Controls in CreateChildControls - Is this bad?

Someone told me it was but every example I've seen does not have a
problem doing it. They told me I should add the html to the page in
the render method and add the control where I want them to go.

I just wanted to get other people opinion. Examples or greatly
appreciated. Thanks
 
T

Teemu Keiski

Well,

if thinking it from working solution point, it does work, there's no problem
but the drawback with the approach are:

1. You lose ASP.NET's adaptive rendering. If you'd use rendering methods and
especially HtmlTextWriter's methods and enumerations to output the markup,
ASP.NET would be automatically capable to adjust the markup based on
browser.

2. You increase the size of Control tree. It is not performance wise as
increased control tree means more processing for the entire Control tree
(collection).

But as I said, it works, but with certain things to think about.

--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.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

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top