Export (0) Print
Expand All

DynamicField.DataField Property

Gets or sets the name of the data field to bind the DynamicField object to.

Namespace:  System.Web.DynamicData
Assembly:  System.Web.DynamicData (in System.Web.DynamicData.dll)

public virtual string DataField { get; set; }

Property Value

Type: System.String
The name of the data field that the DynamicField object is bound to.

Use the DataField property to specify the data field to bind to the DynamicField object. The data field can be the column name or, for foreign key columns, the relationship name.

By default, the specified data field is displayed by the DynamicField object using the field template that is associated with the field data type. You can change the field template that is rendered for the data field by setting the UIHint property. You can also format the displayed text by setting the DataFormatString property. If a field value is null, an empty string ("") is displayed for the value by default. To specify an alternate caption, set the NullDisplayText property.

Note   If you want to change the display and behavior of a data field globally, you must apply attributes to your data model instead of setting this in a particular instance of the DynamicField object. For more information, see ASP.NET Dynamic Data.

The OnFieldChanged method is called to raise a state change event when the DataField property is set.

The value of the DataField property is stored in view state.

.NET Framework

Supported in: 4.5, 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft