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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.