Creating a DivView Control

Let’s start simple. In this section, we create a custom databound control named the DivView control, which displays a set of data items (database records) in HTML <div> tags.

The DivView control inherits from the base CompositeDataBoundControl class and overrides a single method of the base class. The DivView control overrides the base class’s CreateChildControls() method.

The DivView control is contained in Listing 37.9.

Listing 37.9. DivView.cs

images

images

The DivView control supports an ItemTemplate used to format each of its ...

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.