Add Field Dialog Box

The Add Field dialog box enables you to add a new column to an ASP.NET GridView control, or add a new row to an ASP.NET DetailsView control. The dialog box enables you to specify the following:

  • A type of data field to add.

  • Header text.

After selecting a field type, you can set other field properties. The field properties that are available vary according to what type of field you are working with.

Note

You can also use the Add button in the Fields dialog box to add fields to these controls. For more information, see Fields Dialog Box.

To open the Add Field dialog box

  1. In Visual Web Developer, create or open an .aspx page.

  2. Switch to Design view.

  3. From the Data group in the Toolbox, drag a GridView or DetailsView control onto the page.

  4. Right-click the control and then click Show Smart Tag.

    The tasks window for the control opens.

  5. Click Add New Column (GridView control) or Add New Field (DetailsView control).

Tasks

UI Elements

  • Choose a field type
    Lists all of the fields that the control can display, divided into the following nodes, which 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.

    • 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.

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

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

  • Header text
    Sets the header text for the new field.

  • Other field properties
    Sets other properties for the field that you specify in the Choose a field type drop-down list.

  • Refresh Schema
    Refreshes the data in your page in Design view.

    Note

    This UI element displays only if you have already configured a data source for the control.

See Also

Reference

Fields Dialog Box

DetailsView Web Server Control Overview

GridView Web Server Control Overview

Data Source Configuration Wizard (Visual Web Developer)