This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Add Hotlink Snippet (ArcObjects .NET 10.4 SDK) |
Adds a hotlink for the specified field in an IFeatureLayer.
///<summary>Adds a hotlink for the specified field in an IFeatureLayer.</summary> /// ///<param name="hotlinkField">A System.String that is the name of the field that contains the hotlink URL's of the web site to link to. Example: "URLfield"</param> ///<param name="featureLayer">An IFeatureLayer interface</param> /// ///<remarks></remarks> public void AddHotlink(System.String hotlinkField, ESRI.ArcGIS.Carto.IFeatureLayer featureLayer) { if(hotlinkField == null || featureLayer == null) { return; } ESRI.ArcGIS.Carto.IHotlinkContainer hotlinkContainer=featureLayer as ESRI.ArcGIS.Carto.IHotlinkContainer; // Dynamic Cast hotlinkContainer.HotlinkField=hotlinkField; hotlinkContainer.HotlinkType=ESRI.ArcGIS.Carto.esriHyperlinkType.esriHyperlinkTypeURL; }
'''<summary>Adds a hotlink for the specified field in an IFeatureLayer.</summary> ''' '''<param name="hotlinkField">A System.String that is the name of the field that contains the hotlink URL's of the web site to link to. Example: "URLfield"</param> '''<param name="featureLayer">An IFeatureLayer interface</param> ''' '''<remarks></remarks> Public Sub AddHotlink(ByVal hotlinkField As System.String, ByVal featureLayer As ESRI.ArcGIS.Carto.IFeatureLayer) If hotlinkField Is Nothing OrElse featureLayer Is Nothing Then Return End If Dim hotlinkContainer As ESRI.ArcGIS.Carto.IHotlinkContainer=TryCast(featureLayer, ESRI.ArcGIS.Carto.IHotlinkContainer) ' Dynamic Cast hotlinkContainer.HotlinkField=hotlinkField hotlinkContainer.HotlinkType=ESRI.ArcGIS.Carto.esriHyperlinkType.esriHyperlinkTypeURL End Sub