10

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 ?

2 Answers 2

7

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!

6

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');
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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