Rendering Controls

The WebControl class introduces the Render method. You can override the Render method to perform custom HTML rendering via the System.Web.UI.HtmlTextWriter object passed to the Render method.

HtmlTextWriter allows you to add HTML directly to a Web page through generic and specific methods both designed for this purpose. Render is commonly used by server controls to update their presentation on the client.

The HtmlTextWriter object and the Render method can be used to create dynamic pages that are made up of programmatically derived HTML elements. You can write raw HTML or use methods like HTMLTextWriter.WriteBeginTag and HtmlTextWriter.WriteEndTag to simplify rendering the HTML (and probably reduce the likelihood of HTML syntax ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.