ImageFieldValue.Hyperlink Property
Gets or sets the URL for the optional hyperlink on this image.
Namespace: Microsoft.SharePoint.Publishing.Fields
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
Syntax
'Declaration
Public Property Hyperlink As String
Get
Set
'Usage
Dim instance As ImageFieldValue
Dim value As String
value = instance.Hyperlink
instance.Hyperlink = value
public string Hyperlink { get; set; }
Property Value
Type: System.String
The URL for a hyperlink around this image.
Default is an empty string, which means that the image has no hyperlink <A> tag.
Remarks
You can set the URL in this property to any URL reference, although some invalid values may be removed when the value is stored in a SPListItem field value.
The value of this property is the href attribute of an <A> tag that surrounds an <IMG> tag in the ToString method output.
Examples
// You can change any of the following data that are set into the ImageFieldValue
private const string NewImageUrl = "/SiteCollectionImages/SampleImage.jpg";
private const string NewHyperlink = "/Pages/SamplePage.aspx";
private const bool NewOpenHyperlinkInNewWindow = true;
private const string NewAlignment = "right";
private const string NewAlternateText = "Sample alternate text for the image";
private const int NewBorderWidth = 4;
private const int NewHeight = 100;
private const int NewWidth = 150;
private const int NewHorizontalSpacing = 10;
private const int NewVerticalSpacing = 15
Note
This example is part of the larger ImageFieldValue sample in the ImageFieldValue topic.