Completed
Last Updated: 13 Jul 2015 14:29 by ADMIN
ADMIN
Danail Vasilev
Created on: 09 Jul 2015 06:01
Category: Button
Type: Bug Report
0
RadButton with ButtonType="LinkButton" and Target="_blank" opens two windows
For the time being you can use the following JavaScript workaround:

		<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>
0 comments