System.Web.UI.WebControls.ButtonField.DataTextField Property

Gets or sets the name of the data field for which the value is bound to the Button.Text property of the System.Web.UI.WebControls.Button control that is rendered by the System.Web.UI.WebControls.ButtonField object.

Syntax

[System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DefaultValue("")]
public virtual string DataTextField { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When the ButtonFieldBase.ButtonType property of a System.Web.UI.WebControls.ButtonField object is set to the ButtonType.Button or ButtonType.Link value, use the ButtonField.DataTextField property to specify the name of the field to bind to the System.Web.UI.WebControls.ButtonField object. The values of the field are then displayed as the text for the buttons in the System.Web.UI.WebControls.ButtonField object. Optionally, you can format the displayed text by setting the ButtonField.DataTextFormatString property.

Instead of using the ButtonField.DataTextField property to bind a System.Web.UI.WebControls.ButtonField object to a field from a data source, you can use the ButtonField.Text property to display static text for the text of the buttons in the System.Web.UI.WebControls.ButtonField object. When the ButtonField.Text property is used, each button shares the same caption.

Note:

If the ButtonField.DataTextField and ButtonField.Text properties are both set, the ButtonField.DataTextField property takes precedence.

The value of this property is stored in view state.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0