This is a migrated thread and some comments may be shown as answers.

LinkButton Mode Opens Two Windows when target is _blank

3 Answers 644 Views
Button
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 08 Jul 2015, 12:48 PM

The latest release introduces what appears to be a bug with RadButton. When ButtonType is set to LinkButton and target=_blank, the button will open two new tabs in browser instead of one. This behavior is easily reproduced with the following:

 <telerik:RadButton ID="radbtnVehicleList" runat="server" Text="Google" Skin="MetroTouch" Width="200px" NavigateUrl="http://google.com" ButtonType="LinkButton" AutoPostBack="false" Target="_blank" ></telerik:RadButton>

 

Is there a work around?

Charles

3 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 10 Jul 2015, 07:19 AM
Hi Charles,

I have already replied to the forum post that was opened by you on the matter, so that I paste my answer below for the rest of the community:

I confirm this is an issue with the control. I have logged it here (
http://feedback.telerik.com/Project/108/Feedback/Details/163485), so that you can comment and monitor its progress

For the time being you can use the following JavaScript workaround:
Copy Code
<telerik:RadButton ID="radbtnVehicleList" runat="server" Text="Google" Skin="Default" Width="200px"
    NavigateUrl="http://www.telerik.com" ButtonType="LinkButton" AutoPostBack="false" Target="_blank">
</telerik:RadButton>
<script>
    Telerik.Web.UI.Button.NavigationFunctionality.prototype = {
        clicked: function (ev) {
            var that = this;
 
            that.base.clicked(ev);
 
            that._handleNavigateUrl();
        },
 
        _handleNavigateUrl: function () {
            var that = this,
                target = that.options.navigateTarget,
                url = that.options.navigateUrl;
 
            if (!url) return;
 
            if (target && target == "_blank")
                window.open(url);
            else if (target && target == "_parent")
                window.parent.location.href = url;
            else if (target && target == "_top")
                window.top.location.href = url;
            else if (!target || target == "_self")
                window.location.href = url;
            else {
                var targetFrame = $("iframe[name='" + target + "']").get(0) ||
                                    $("frame[name='" + target + "']").get(0) ||
                                    $("#" + target).get(0);
 
                if (targetFrame && targetFrame.tagName.toLowerCase().indexOf("frame") > -1) {
                    targetFrame.setAttribute("src", url);
                } else if (target) {
                    window.open(url, target);
                }
            }
        }
 
    };
</script>



Regards,
Danail Vasilev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ralf
Top achievements
Rank 2
answered on 20 Jul 2015, 02:22 PM

This bug costs me 1/2 Day !!!

 When you publish SP1?

0
Danail Vasilev
Telerik team
answered on 22 Jul 2015, 11:34 AM
Hi Ralf,

I am sorry to hear you were having issues on the matter.

The Q2 2015 SP1 release is scheduled for the end of next week.

Regards,
Danail Vasilev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Button
Asked by
Charles
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Ralf
Top achievements
Rank 2
Share this question
or