12.3. Customizing the Appearance of the Data Controls

By default, the GridView and DetailsView render columns or rows automatically based on the data they receive. Alternatively, you can have VWD create a number of fields or columns for you when you attach the control to a data source. But, more often than not, you want to change what you see on screen, be it fewer columns, different column headings, or different controls to display data. Fortunately, this is really easy to do with the Fields editor in VWD. In the next section you see how to use this editor to create and modify the different types of built-in columns and fields. In the section that follows, you see how to customize the fields even further with user-defined templates.

12.3.1. Configuring Columns or Fields of Data-Bound Controls

Within the <Columns> or <Fields> element of the GridView and the DetailsView, you can add the types of fields shown in the following table.

Field TypeDescription
BoundFieldThis is the default field for most data base types. It renders as simple text in read-only mode, and as a TextBox in edit mode.
ButtonFieldThis type renders as a link or a button allowing you to execute a command on the server.
CheckBoxFieldThis type renders as a read-only checkbox in read-only mode, and as an editable checkbox in edit mode.
CommandFieldThis type enables you to set up various commands, including editing, inserting, updating, and deleting.
HyperLinkFieldThis type renders as a link (an <a> element). You can ...

Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.