HyperLinkColumn::DataTextField Property
Gets or sets the field from a data source to bind to the text caption of the hyperlinks in the HyperLinkColumn.
Assembly: System.Web (in System.Web.dll)
public: virtual property String^ DataTextField { String^ get (); void set (String^ value); }
Property Value
Type: System::StringThe 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note