Try our conversational search powered by Generative AI!

Option for URL to open in new window in ContentReference single URL



I am using EPiServer 9 version. I have used Content  Reference and URL types for Link URLs. But in these EPiServer does not give built in option for the editors to choose to open a link in same or new window. This option extists for LinkItemCollection and Link in TinyMCE editor. 

Could anyone tell me how can I make a ContentRefrence or URL to give such option. And if it is not possible any other solution or work around to solve this limitation?

Thanks in advance.

Sanket Mahimkar

Jan 13, 2016 14:23

You can create a block for this, or add an additional target frame property to your page/block. This is an example of the block approach.

[ContentType(AvailableInEditMode = false)]
public class PageLinkBlock : BlockData
   public virtual ContentReference Link { get; set; }

   public virtual int? TargetFrameRaw { get; set; }

   public string TargetFrame 
         if (TargetFrameRaw.HasValue) 
            var frame = EPiServer.DataAbstraction.Frame.Load(TargetFrameRaw.Value);
            return frame.Name;

         return null;

The view can look something like this:

@model PageLinkBlock

@Html.ContentLink(Model.Link, null, new { target = Model.TargetFrame })

On your page/block:

public virtual PageLinkBlock MyLink { get; set; }
Jan 13, 2016 14:55
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.