LinkFieldValue.ToString Method
Returns an HTML string with an <A> tag and properties with values as currently set for this LinkFieldValue object.
Namespace: Microsoft.SharePoint.Publishing.Fields
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel := True)> _
Public Overrides Function ToString As String
'Usage
Dim instance As LinkFieldValue
Dim returnValue As String
returnValue = instance.ToString()
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
public override string ToString()
Return Value
Type: System.String
An HTML string with an <A> tag and properties with values as currently set for this LinkFieldValue, or an empty string.
Remarks
If the href property does not have a value, this method returns an empty string. Otherwise, this method returns an HTML string that contains an <A> tag. Only certain properties are recognized on the <A> and <IMG> tags, and are used to generate the HTML string.
Examples
// Retrieve the current value from an SPListItem object
// with a column of the LinkField type with the
// name linkFieldName.
LinkFieldValue currentFieldValue =
listItemWithLinkField[linkFieldName] as LinkFieldValue;
// If there is no current value, construct a new empty value.
if (null == currentFieldValue)
{
currentFieldValue = new LinkFieldValue();
}
// If this property is not set to a value, the ToString() for the
// LinkFieldValue returns String.Empty and nothing is stored in
// the field value when it is set back into the SPListItem.
currentFieldValue.href = Newhref;
Note
This example is part of the larger LinkFieldValue sample in the LinkFieldValue topic.