Templated Columns in Action

As powerful as it is, a DataGrid control handles data only in terms of columns, and it can display only information that can be expressed by using a data field name. More often than not, these restrictions are too limiting to build a really user-friendly interface. For example, suppose you have three fields to display: first name, last name, and a title of courtesy, such as "Mr.", "Mrs.", or "Dr." The query selects three distinct fields, and your simplest option is to display that data in a DataGrid control that uses three distinct columns. Figure 3-1 shows the results.

Figure 3-1. The DataGrid control must display even simple information in a column format.

Figure 3-1 is clear, but the full name looks unusual ...

Get Building Web Solutions with ASP.NET and ADO.NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.