The user interface of a DataGrid control comprises several types of items. These item types are grouped in the ListItemType enumeration. Each item plays a clear role and has a precise location in the hierarchy of the control’s user interface, as Figure 2-1 shows.
A DataGrid control is formed by using any combination of eight different items. Each item maps to a template style property of the DataGrid control, but remember from Chapter 1 that templates for DataGrid differ from those of DataList because they apply to the columns rather than to the control. Table 2-1 describes the graphical items that form an ASP.NET DataGrid control.
Each time an item in Table 2-1 is about to be created, an ItemCreated event is fired. By handling this event, you can customize the way in which the item—for example, a column caption or the pager bar—is rendered. Note that the ItemCreated event is not raised for each column but only once when the DataGrid control has finished creating the whole item. For example, the footer and header events are raised only when the header and the footer for each column have been created. Later in this chapter, you’ll learn to use the ItemCreated event.