Fields Dialog Box

The Fields dialog box allows you to manage the fields (columns or rows) that are displayed by the ASP.NET GridView and DetailsView Web server controls. The dialog box allows you to specify:

  • Which data fields to display.

  • Fields for special functions such as editing and selecting items.

  • Template fields that enable you to create your own layout.

  • Field-specific information for individual columns, such as a sort expression and command name.

  • Header and footer, contents, and data binding for each field.

After defining a field, you can set its properties. The properties available change according to what type of fieldyou are working with.

You can open Fields dialog box by right-clicking the control in Design view, and then clicking Edit Columns (GridView control) or Edit Fields (DetailsView control).

Tasks

UI Elements

  • Available fields
    Lists all fields that the control can display, divided into the following nodes that you can expand:

    • BoundField   Use to add individual data fields from those available in the data source.

    • CheckBoxField   Use to add a field bound to a Boolean field in the data source.

    • HyperLinkField   Use to add a field that will contain a link to another page. The hyperlink field can contain static text or display a data field as a hyperlink.

    • ImageField   Use to add a field that will contain images.

    • ButtonField   Use to add fields that will contain buttons (command buttons or link buttons) that the user can click to perform specific actions for an individual item. You can specify whether to use a Button, LinkButton, or ImageButton control by setting the field's ButtonType property.

    • CommandField   Use to add a field which will contain links that will post back commands, such as Delete, Edit/Update/Cancel, New/Insert/Cancel, and Select.

    • TemplateField   Use to create a field that contains any combination of HTML text and controls.

  • Selected fields
    Displays a list of fields that you can customize. When you select a column in this list, the Field properties box displays the field's properties. Use the buttons next to the Selected fields box to rearrange or remove a field.

  • Auto-generate fields
    Specifies whether the control creates fields for all the data fields from the data source to which it is bound. You cannot remove or format auto-generated fields.

    You can add fields even if you specify that the control should auto-generate fields. Any fields you add appear in addition to fields generated automatically.

  • Field properties
    Enables you to customize the currently selected node.

  • Convert this field into a TemplateField
    Recreate the selected field to use a template, which is a combination of HTML text and controls. This allows you to create a custom layout for the field.

See Also

Reference

GridView Web Server Control Overview

DetailsView Web Server Control Overview

Add Field Dialog Box