Skip to content

Instantly share code, notes, and snippets.

@seanrco
Created February 28, 2018 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanrco/290d5c4cc88cdee2b207d8693c0c9ef4 to your computer and use it in GitHub Desktop.
Save seanrco/290d5c4cc88cdee2b207d8693c0c9ef4 to your computer and use it in GitHub Desktop.
_Functions addition for getting Link Target attribute.
/// <summary>
/// Get a link's action suitable for use in the 'a' attribute.
/// </summary>
/// <param name="link">Link element</param>
/// <param name="url">Url helper</param>
/// <returns>Link action</returns>
public static string GetLinkTarget(ICMSLinkElement link, UrlHelper url)
{
String linkUrl = "";
if (link != null)
{
linkUrl = (!String.IsNullOrWhiteSpace(link.GetAttributeValue("CustomURLTarget"))) ? link.GetAttributeValue("CustomURLTarget") : link.GetAttributeValue("Target");
}
//remove tfrm=4 for page preview
return linkUrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment