Chapter 10 Creating Bindable Grids of Data

 

Overview

Data-bound controls play a key role in the development of ASP.NET applications. Data-driven controls allow you to associate the whole interface, or individual properties, with one or more columns read out of a .NET-compliant data source. We already mentioned data-bound controls in Chapter 9 and reviewed their basics. In this chapter, we'll delve into the details of a couple of extremely versatile data-bound controls that are a fixed presence in any real-world ASP.NET application the DataGrid control in ASP.NET 1.x and the GridView control in ASP.NET 2.0.

Both controls render a multicolumn, templated grid and provide a largely customizable user interface with read/write options. In spite of the rather advanced programming interface and the extremely rich set of attributes, the DataGrid and GridView controls simply generate an HTML table with interspersed hyperlinks to provide interactive functionalities such as sorting, paging, selection, and in-place editing.

Although they are customizable at will, grid controls feature a relatively rigid and inflexible graphical model. The data bound to a DataGrid or GridView is always rendered like a table, therefore, in terms of rows and columns. As we'll see later in the chapter, though, the contents of the cells in a column can be customizable to some extent using system-provided as well as user-defined templates.

The DataGrid is the principal control of most data-driven ASP.NET 1.x applications. Like all ASP.NET 1.x controls, the DataGrid is fully supported in ASP.NET 2.0 but is partnered with a newer control that is meant to replace it in the long run. The new grid control, GridView, is complemented by other view controls, such as DetailsView and FormView. (We'll cover DetailsView and FormView in the next chapter.) The GridView is a major upgrade of the ASP.NET 1.x DataGrid control. It provides the same basic set of capabilities, plus a long list of extensions and improvements.

In this chapter, we'll first take a look at the DataGrid capabilities and try to identify and discuss its major shortcomings and limitations. Then we'll consider the GridView control and its modified programming interface. For brand-new ASP.NET 2.0 applications, choosing the GridView over the DataGrid is a no-brainer. For ASP.NET 1.x applications that are being maintained, a move to the GridView doesn't present any significant difficulties and such a move positions you well for future enhancements.

 


Programming Microsoft ASP. Net 2.0 Core Reference
Programming Microsoft ASP.NET 2.0 Core Reference
ISBN: 0735621764
EAN: 2147483647
Year: 2004
Pages: 112
Authors: Dino Esposito
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net