AutoGeneratedField Class

Note: This class is new in the .NET Framework version 2.0.

Represents an automatically generated field in a data-bound control. This class cannot be inherited.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public ref class AutoGeneratedField sealed : public BoundField
public final class AutoGeneratedField extends BoundField
public final class AutoGeneratedField extends BoundField

The AutoGeneratedField class is used to represent an automatically generated field in a data-bound control, such as GridView or DetailsView. Automatically generated fields are created by a data-bound control when the appropriate property is set to true (for example, the AutoGenerateColumns property for the GridView control, the AutoGenerateRows property for the DetailsView control, and so on).


Automatically generated fields are not added to the field collection of a data-bound control (for example, the Columns collection for the GridView control, the Fields collection for the DetailsView control, and so on).

The AutoGeneratedField class is intended for use internally by data-bound controls. Unlike other data fields (such as BoundField, CheckBoxField, TemplateField, and so on), the AutoGeneratedField class cannot be placed declaratively on a page as part of a field collection. Although you can programmatically add an AutoGeneratedField object to a field collection, this design pattern should be avoided.

Because automatically generated fields represent the automatic rendering of a field, data-bound controls do not typically allow users to modify the properties of the AutoGeneratedField objects. If the automatic rendering is not suitable for your needs, define your own data fields for the field collection of the control.

The following example demonstrates how to create an AutoGeneratedField object for a custom control that derives from the DetailsView control.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions