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
In Visual Web Developer, create or open an .aspx page.
Switch to Design view.
From the Data group in the Toolbox, drag a GridView or DetailsView control onto the page.
Right-click the control and then click Show Smart Tag.
The tasks window for the control opens.
Click Add New Column (GridView control) or Add New Field (DetailsView control).
Tasks
How to: Customize Controls for Editing in the GridView Web Server Control
Walkthrough: Displaying Data Using a Stored Procedure in the GridView Web Server Control
How to: Respond to Button Events in DataList or Repeater Items
Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control
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
DetailsView Web Server Control Overview