Building Fully Rendered Controls

Let’s start by creating a simple fully rendered control. When you create a fully rendered control, you take on the responsibility of specifying all the HTML content that the control renders to the browser.

The file in Listing 36.1 contains a fully rendered control that derives from the base Control class.

Listing 36.1. FullyRenderedControl.cs

images

Note

Add the control in Listing 36.1 to your App_Code folder. Any code added to the App_Code folder is compiled dynamically.

The control in Listing 36.1 inherits from the base Control class, overriding the base class Render() method. The control simply displays whatever ...

Get ASP.NET 4 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.