HyperLinkColumn.DataTextField Property
Assembly: System.Web (in system.web.dll)
public: virtual property String^ DataTextField { String^ get (); void set (String^ value); }
/** @property */ public String get_DataTextField () /** @property */ public void set_DataTextField (String value)
public function get DataTextField () : String public function set DataTextField (value : String)
Not applicable.
Property Value
The field name from a data source to bind to the text caption of the hyperlinks in HyperLinkColumn.Use the DataTextField property to specify the field name from a data source to bind to the text caption of the hyperlinks in HyperLinkColumn. When the text caption is data bound to a field, the text caption of each hyperlink in the column is set with a corresponding value in the specified field. This allows you to set a different text caption for each hyperlink in the column. To specify the same text caption for each row in the column, set the Text property instead of this property.
Note: |
|---|
| The DataTextField and Text properties cannot both be set at the same time. If both properties are set, the DataTextField property takes precedence. |
When you using data binding, you can specify a custom display format for the text caption of the hyperlinks by setting the DataTextFormatString property.
The following example demonstrates how to use the DataTextField property to specify the field in the data source to bind to the text caption of the hyperlinks in the HyperLinkColumn.
Note: |
|---|
| The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model. |
The following corresponding example displays the item selected in the previous example.
Note: