LinkButton Mode Opens Two Windows when target is _blank

4 posts, 0 answers
  1. Charles
    Charles avatar
    30 posts
    Member since:
    Feb 2013

    Posted 08 Jul 2015 Link to this post

    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

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 10 Jul 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ralf
    Ralf avatar
    8 posts
    Member since:
    May 2012

    Posted 20 Jul 2015 in reply to Danail Vasilev Link to this post

    This bug costs me 1/2 Day !!!

     When you publish SP1?

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 22 Jul 2015 Link to this post

    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
Back to Top