asp.net.ph

DetailsView.Fields Property

System.Web.UI.WebControls Namespace   DetailsView Class


.NET Framework version 2.0

Returns a collection of DataControlField objects that represent the row fields in a DetailsView control.

Syntax


Script [ DataControlFieldCollection variable = ] DetailsView.Fields

This property can only be used programmatically; it cannot be set when declaring the control.

Property Value


variable A DataControlFieldCollection object that consists of the row fields in a DetailsView control.

The property is read only with no default value.

Remarks

Use this property to programmatically manage the collection of fields in the DetailsView control. The Fields collection contains explicitly declared fields that get rendered in the DetailsView control.

NOTE: Explicitly declared fields may be used in conjunction with automatically generated fields. When using both, explicitly declared fields will be rendered first, followed by the automatically generated fields. Automatically generated fields are not added to the Fields collection.

The order that the row fields are displayed in the DetailsView control is controlled by the order that the row fields appear in the Fields collection.

The following table shows the different field classes that derive from the DataControlField class and can be used in the Fields collection.

Field Type Description
BoundField Displays a field bound to a field in a data source, that displays each row in the field as text. This is the default field type of the DetailsView control.
ButtonField Displays a command button for each row in the field. This allows you to create a field of custom button controls, such as the Add or Remove button.
CheckBoxField Displays a check box for each row in the DetailsView control. This field field type is commonly used to display fields with a Boolean value.
CommandField Displays predefined command buttons to perform selecting, editing, or deleting operations.
HyperLinkField Displays the contents of each row in the field as a hyperlink. The contents of the field can be bound to a field in a data source or static text.
ImageField Displays an image for each row in the DetailsView control.
TemplateField Displays each row in the field following a specified template. This allows you to provide custom controls in the field.

NOTE: While you can programmatically add fields to the Fields collection, it is easier to list the row fields declaratively and then use the Visible property to show or hide the field.

See Also

DetailsView Members   DataControlField   BoundField   ButtonField   CheckBoxField   CommandField   HyperLinkField   ImageField   TemplateField Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph