HtmlTextWriter: why do we need it and how is its performance?

  • Thread starter Rukmal Fernando
  • Start date
R

Rukmal Fernando

Just rephrasing the subject...

Hi,

I had a lot of work to do in rendering a custom web control by coding it
using calls like

protected override void Render(HtmlTextWriter output)
{
output.Write(HtmlTextWriterTag.<tag>);
myControl1.Render(output);
...
}

Afterwards, I wrote a helper method so that I could build an HTML string
with placeholders for each of the controls and then tokenizing the HTML
string to write the HTML as a string and then calling the control's render
method.

eg: string HTMLString = "<TABLE>...{0}...{1}"
and pass it in like WriteHTML(HTMLString, myControl1, myControl2...);

This seemed to work ok, but now I'm wondering why the HtmlTextWriterTag enum
exists and whether my rendering html content as strings is sub-optmal.

If anyone knows how these two techniques execute, I'd be really grateful to
hear from you.

Thanks!

Rukmal.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top