Writing html with HTMLTextWriter in irregular order

366 views Asked by At

I generate a html page with HTMLTextWriter. At one point I do need some information, which I haven't yet. I will get them later. It is not possible to workaround and to get the information earlier.

Is there a way, how I can jump back as soon as I get the information and add the missing items?

1

There are 1 answers

1
samjudson On BEST ANSWER

All classes that inherit from System.IO.TextWriter are specifically for writing a sequential series of characters or other information.

http://msdn.microsoft.com/en-us/library/system.io.textwriter.aspx

So, basically no, there isn't a way to jump backwards in one of these classes.

You would likely use an XElement instance to create your HTML, and then use the XElement.Save(TextWriter) method to write it to the writer once complete.