Chapter 19. Using the DataList Control

OBJECTIVES

  • Learn to use the DataList control

  • Use DataList control templates

  • Display images within a DataList control

  • Edit data within a DataList control

The third of the list-bound controls provided by ASP.NET, the DataList control, provides some of the best features of the other two, the Repeater and DataGrid controls. If you want the template-based layout features provided by the Repeater, but you want to be able to edit data in place, the DataList control is for you.

The DataList control allows you to lay out separate templates for normal and alternating items, edited and selected items, headers and footers, and separators. In addition, the DataList control provides a designer where you can lay out the templates (as opposed to the Repeater, which doesn't).

Although the DataList control won't replace the DataGrid control if you need to display tabular data, and there's no reason carrying around the complexities of the DataGrid control if your only goal is to display a simple list of bound data (the Repeater handles this just fine), we think you'll find the DataList control has a solid place right in the middle. It allows you flexible layout that you won't get with the DataGrid control as well as editing that you won't get with the Repeater.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.42.116