HtmlTextWriter fluent interface

When working on new features in IZWebFileManager I needed to change rendered HTML.

I took a look at the code I wrote more then 3 years ago…. It is so complicated!

IZWebFileManager is a typical custom control that overrides Render and uses HtmlTextWriter’s API to produce HTML. Here is a small part of the rendering flow:

It took me a while to figure out what is HTML is rendered here.
The fact is, that HtmlTextWriter’s API is not intuitive and requires a lot of effort to produce relatively simple HTML. Is there a alternative way to render output?

WhenLINQ has been released all the .NET world has met fluent APIs, and I was wandering if there is such an API for rendering ASP.NET controls.

I found this one:

I’ve just added it to my project (made it internal to prevent collisions), changed it a bit and rewrote the code above:

Now it is much easier to change the rendered HTML, because this code flow is much closer to the HTML markup flow, than when it was written using the “classic” HtmlTextWriter API.<div class="blogger-post-footer"></div>

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at