Chapter 1. An Introduction to the DataGrid, DataList, and Repeater
IN THIS CHAPTER
The DataGrid, DataList, and Repeater are three Web controls provided by ASP.NET, each of which can be used to display data on an ASP.NET Web page. At first glance, these three controls might seem very similar. After all, they are all useful for displaying data in a structured manner, as we'll briefly touch upon in this chapter, but that is about where the similarities end. Their differences, which we'll also be examining in this chapter, are subtler.
Along with the similarities and differences among these controls, each control carries with it a set of advantages and disadvantages. For example, the DataGrid Web control provides built-in capabilities for paging and sorting the data, while the Repeater does not. However, the DataGrid is always rendered as an HTML table, whereas the Repeater allows for much more flexibility, allowing the developer to specify exactly the HTML that should appear in the rendered output.
When using these controls in a real-world project, one must examine the subtle differences between them, along with their associated advantages and disadvantages, when deciding which control to use for a given situation. This chapter concludes with a discussion of what controls are appropriate in what circumstances, along with some real-world examples and what controls one might want to use.