Prev | Current Page 387 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"


The ItemTemplate and AlternatingItemTemplate templates are applied to each row of data
retrieved from the data source based on an alternating pattern. The SeparatorTemplate template is
placed between the item templates to keep things looking nice. The diagram in Figure 7-2 shows
how the templates determine the output of the control rendering process.
Our Repeater control implements a fairly sophisticated system of events that provide rich
functionality: ItemCommand, ItemCreated, and ItemDataBound. ItemCommand is an event raised by
our Repeater control that aggregates bubbled command events raised by subordinate command
controls such as an ASP.NET Button control. We discuss these events in detail in the section
titled ???Repeater Control Event Management??? later in this chapter.
The ItemCreated event is raised each time a RepeaterItem control is created. This gives the
client of the event an opportunity to modify or change the final control output in the template
dynamically. ItemDataBound gives the same opportunity, except it is raised after any data binding
has been performed on a template. This event is limited to the ItemTemplate and
AlternatingItemTemplate templates, because the header and footer templates do not support
data binding.


Pages:
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399