DynamicField Class
Updated: July 2008
Represents a data field that is displayed in a data-bound control that uses ASP.NET Dynamic Data features.
Assembly: System.Web.DynamicData (in System.Web.DynamicData.dll)
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class DynamicField : public DataControlField, IAttributeAccessor, IFieldFormattingOptions
The DynamicField class is used by data-bound controls, such as GridView and DetailsView, to display a field value that uses ASP.NET Dynamic Data features in custom pages.
The DynamicField class provides functionality that resembles that of the BoundField class. However, because a DynamicField object is used in Dynamic Data applications, you can take advantage of the following Dynamic Data features:
Automatically rendering the proper control for a field by using field templates, based on the data type. The field templates can be globally modified for the entire application.
Providing built-in data validation based on the database schema. You can also add validation types by customizing the data model.
Customizing data rendering for individual fields by using attributes in the data model or by using the UIHint property.
The DynamicField object renders each field by using a DynamicControl control. To specify the data field to display in a DynamicField object, set the DataField property to the field name. You can apply a custom formatting string to the field value by setting the DataFormatString property. By default the formatting string is applied to field values only when the data-bound control is in read-only mode. To apply the formatting string to values displayed while the data-bound control is in edit mode, set the ApplyFormatInEditMode property to true. If a field value is nullptr, you can display a custom caption by setting the NullDisplayText property. The DynamicField object can also automatically convert empty string ("") field values to null values by setting the ConvertEmptyStringToNull property to true.
See a run-time code example of this feature: Run.
- AspNetHostingPermission
for operating in a hosted environment. Security action: LinkDemand. Associated enumeration: AspNetHostingPermissionLevel::Minimal
- AspNetHostingPermission
for operating in a hosted environment. Security action: InheritanceDemand. Associated enumeration: AspNetHostingPermissionLevel::Minimal
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.