Using fields with the GridView control

The GridView control is used to render an HTML table containing a list of data items. However, when the GridView controls renders its columns automatically, control over column formatting is lost. To maintain control over column formatting, following column field elements are used. Using these elements we can display DropDownLists or HyperLinks or Images in GridView columns.



Note that these are the only fields which we can use in a GridView control.
Field Description
asp:BoundField Enables us to display the value of a data item in a data source as text
asp:ButtonField Enables us to display a button or the value of a data item as a button
asp:CheckBoxField Enables us to display the value of a data item as a check box
asp:CommandField Displays select, edit, delete, update or cancel buttons
asp:HyperLinkField Displays a hyperlink
asp:ImageField Displays an image
asp:TemplateField Enables customization of the appearance of a data item