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

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