October 2010
Intermediate to advanced
1920 pages
73h 55m
English
TemplateFieldsA TemplateField enables you to add any content to a GridView column that you need, which can contain HTML, DataBinding expressions, or ASP.NET controls.
TemplateFields are particularly useful when you use GridView to edit database records. You can use TemplateField to customize the user interface and add validation to the fields being edited.
For example, the page in Listing 11.27 contains a GridView that enables you to edit the records contained in the Movies database table. TemplateFields render the user interface for editing the movie title and category columns (see Figure 11.19).
Figure 11.19. Using TemplateFields with the GridView control.
Listing 11.27. ShowTemplateField.aspx
GridView in Listing 11.27 contains ...