SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using UrlField for link button,I want to open URL in new window.

<SharePointWebControls:UrlField ID="UrlField2" FieldName="Link Button" runat="server"/>

I have tried target="_blank" but it does not work.

So, is there a way to open the UrlField in a new tab ?

share|improve this question
up vote 5 down vote accepted

Open in new tab is only supported in Publishing URL field. You are using the basic URL field. You need to use PublishingWebControls:RichLinkField. This will give you the "open in new window" option.

Cheers!

share|improve this answer

Since the control has a CssClass Property, you could manipulate the target attribute using JQuery. For example (not tested):

<SharePointWebControls:UrlField ID="UrlField2" FieldName="Link Button" runat="server" CssClass="item-link" />

And on the JQuery side:

$(function() {
    $(".item-link").attr('target', '_blank');
});
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.