I have RadWindow opened as modal within page. RadWindow has the only button (LinkButton):
So when i click button clients script hides RadWindow and postback doesn't occurs (FF 3.6.12) but when i remove client click event it works ok. On Chrome 7 it works with client side event but i get javascript errors "Failed to load resource" ref to my radwindow page just after postback.
Another one thing... If I hide RadWindow from OnClientClick (as descibed above) and after postback on page load form javascript i am trying to change radwindow size or/and its position:
RadWindow becomes visible again. But if i remove above javascript RadWindow will stay invisible after postback.
I use: Telerik.Web.UI, Version=2010.3.1109.40
<
asp:LinkButton
ID
=
"lbProceed"
runat
=
"server"
CausesValidation
=
"false"
OnClientClick
=
"radWnd.Hide();"
OnClick
=
"Proceed_Event"
>Proceed</
asp:LinkButton
>
So when i click button clients script hides RadWindow and postback doesn't occurs (FF 3.6.12) but when i remove client click event it works ok. On Chrome 7 it works with client side event but i get javascript errors "Failed to load resource" ref to my radwindow page just after postback.
Another one thing... If I hide RadWindow from OnClientClick (as descibed above) and after postback on page load form javascript i am trying to change radwindow size or/and its position:
GetRadWindow().setSize(GetRadWindow().getWindowBounds().width, height);
GetRadWindow().center();
$(document).ready(
function
() {
GetRadWindow().setSize(GetRadWindow().getWindowBounds().width, height);
GetRadWindow().center();
});
RadWindow becomes visible again. But if i remove above javascript RadWindow will stay invisible after postback.
I use: Telerik.Web.UI, Version=2010.3.1109.40
4 Answers, 1 is accepted
0
Hello Stephan,
Basically, calling center() on a RadWindow object will show it as this is part of its logic. As for the first problem however, I was not able to reproduce it. Could you please post full sample code that shows your exact setup?
All the best,
Georgi Tunev
the Telerik team
Basically, calling center() on a RadWindow object will show it as this is part of its logic. As for the first problem however, I was not able to reproduce it. Could you please post full sample code that shows your exact setup?
All the best,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
cs137
Top achievements
Rank 1
answered on 03 Dec 2010, 10:32 AM
Hello Georgi,
Here is a simple asp.net project with default page and popup page. On the default page there is the only link button. Popup page opened as Radwindow by clicking on it. In popup page there is another one link button that has two client and server side events. Client event (OnClientClick) just hides RadWindow and server-side event redirects main page to current forum thread:
Web.config:
Site.Master
Default.aspx:
Popup.Master:
Popup.aspx:
Popup.aspx.cs:
Here is a simple asp.net project with default page and popup page. On the default page there is the only link button. Popup page opened as Radwindow by clicking on it. In popup page there is another one link button that has two client and server side events. Client event (OnClientClick) just hides RadWindow and server-side event redirects main page to current forum thread:
Web.config:
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
system.web
>
<
sessionState
timeout
=
"300"
></
sessionState
>
<
globalization
responseEncoding
=
"utf-8"
enableClientBasedCulture
=
"true"
culture
=
"en-US"
uiCulture
=
"auto"
/>
<
pages
enableViewStateMac
=
"false"
controlRenderingCompatibilityVersion
=
"3.5"
clientIDMode
=
"AutoID"
>
<
controls
>
<
add
assembly
=
"Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
namespace
=
"Telerik.Web.UI"
tagPrefix
=
"telerik"
/>
</
controls
>
</
pages
>
<
compilation
debug
=
"true"
targetFramework
=
"4.0"
/>
<
httpHandlers
>
<
add
path
=
"Telerik.Web.UI.DialogHandler.aspx"
verb
=
"*"
type
=
"Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
validate
=
"false"
/>
<
add
path
=
"Telerik.Web.UI.SpellCheckHandler.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
validate
=
"false"
/>
<
add
path
=
"Telerik.Web.UI.WebResource.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
validate
=
"false"
/>
</
httpHandlers
>
</
system.web
>
<
system.webServer
>
<
handlers
>
<
add
name
=
"TelerikDialogHandler"
verb
=
"*"
path
=
"Telerik.Web.UI.DialogHandler.aspx"
type
=
"Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
/>
<
add
name
=
"TelerikSpellCheckHandler"
verb
=
"*"
path
=
"Telerik.Web.UI.SpellCheckHandler.axd"
type
=
"Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
/>
<
add
name
=
"Telerik.Web.UI.WebResource"
path
=
"Telerik.Web.UI.WebResource.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
/>
</
handlers
>
<
modules
runAllManagedModulesForAllRequests
=
"true"
/>
</
system.webServer
>
</
configuration
>
Site.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="RadWindowHide.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
xml:lang
=
"en"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
link
href
=
"~/Styles/Site.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
asp:ContentPlaceHolder
ID
=
"HeadContent"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
head
>
<
body
>
<
form
runat
=
"server"
>
<
div
class
=
"page"
>
<
div
class
=
"main"
>
<
asp:ContentPlaceHolder
ID
=
"MainContent"
runat
=
"server"
/>
</
div
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"ScriptManager1"
EnableCdn
=
"true"
EnableScriptLocalization
=
"false"
EnableScriptCombine
=
"true"
>
<
CdnSettings
TelerikCdn
=
"Enabled"
/>
<
CompositeScript
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Path
=
"~/Scripts/jquery-telerik.js"
/>
</
Scripts
>
</
CompositeScript
>
</
telerik:RadScriptManager
>
</
div
>
<
telerik:RadWindowManager
Visible
=
"true"
VisibleStatusbar
=
"false"
Behaviors
=
"Close"
ReloadOnShow
=
"true"
Modal
=
"true"
DestroyOnClose
=
"true"
ID
=
"Singleton"
VisibleOnPageLoad
=
"false"
runat
=
"server"
>
</
telerik:RadWindowManager
>
</
form
>
</
body
>
</
html
>
Default.aspx:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="RadWindowHide._Default" %>
<
asp:Content
ID
=
"HeaderContent"
runat
=
"server"
ContentPlaceHolderID
=
"HeadContent"
>
</
asp:Content
>
<
asp:Content
ID
=
"BodyContent"
runat
=
"server"
ContentPlaceHolderID
=
"MainContent"
>
<
telerik:RadScriptBlock
runat
=
"server"
ID
=
"scriptBlock"
>
<
script
type
=
"text/javascript"
>
function ShowPopupWindow() {
var url = "Popup.aspx";
var oWnd = window.radopen(url, "PopupTest");
oWnd.set_modal(true);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize);
oWnd.setSize(462, 200);
oWnd.center();
}
</
script
>
</
telerik:RadScriptBlock
>
<
asp:LinkButton
ID
=
"lbOpenPopup"
runat
=
"server"
CausesValidation
=
"false"
OnClientClick
=
"ShowPopupWindow(); return false;"
>Open Popup</
asp:LinkButton
>
</
asp:Content
>
Popup.Master:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Popup.master.cs" Inherits="RadWindowHide.Popup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement && window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
return oWindow;
}
function GetParentWindow() {
return GetRadWindow().BrowserWindow;
}
</
script
>
<
title
></
title
>
<
asp:ContentPlaceHolder
ID
=
"head"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
EnablePartialRendering
=
"true"
EnablePageMethods
=
"true"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI, Version=2010.3.1109.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Path
=
"~/Scripts/jquery-telerik.js"
/>
</
Scripts
>
</
asp:ScriptManager
>
<
div
class
=
"windows"
>
<
asp:ContentPlaceHolder
ID
=
"CenterContentPlaceHolder"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
div
>
</
form
>
</
body
>
</
html
>
Popup.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Popup.Master" AutoEventWireup="true" CodeBehind="Popup.aspx.cs" Inherits="RadWindowHide.Popup1" %>
<
asp:Content
ID
=
"Content4"
ContentPlaceHolderID
=
"CenterContentPlaceHolder"
runat
=
"server"
>
<
asp:LinkButton
ID
=
"lbProceed"
runat
=
"server"
CausesValidation
=
"false"
OnClientClick
=
"GetRadWindow().Hide();"
OnClick
=
"ProceedContractModify"
>Proceed</
asp:LinkButton
>
</
asp:Content
>
Popup.aspx.cs:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
RadWindowHide {
public
partial
class
Popup1 : System.Web.UI.Page {
protected
void
Page_Load(
object
sender, EventArgs e) {
}
protected
void
ProceedContractModify(
object
sender, EventArgs e) {
this
.Page.ClientScript.RegisterStartupScript(
this
.GetType(),
"modifyconfirm"
,
"$(document).ready(function () { GetParentWindow().location = 'http://www.telerik.com/community/forums/aspnet-ajax/window/radwindow-hide-from-javascript-tricks.aspx'; GetRadWindow().Close(); });"
,
true
);
}
}
}
0
Hello Stephan,
Thank you for the sample - now I have a better view over your setup. To avoid the problem I would suggest not to hide the RadWindow in OnClientClick and to leave only the location setting in the codebehind - there is no need to close a hidden window when you are navigating the parent page to another location - RadWindow will be destroyed anyway.
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "modifyconfirm", "GetParentWindow().location = 'http://www.telerik.com/community/forums/aspnet-ajax/window/radwindow-hide-from-javascript-tricks.aspx';", true);
In addition, if the parent page is the topmost page (i.e. the one directly loaded in the browser), you can remove GetParentWindow as well and replace it with top.
e.g. top.location.href = "http://myurl.com";
Best wishes,
Georgi Tunev
the Telerik team
Thank you for the sample - now I have a better view over your setup. To avoid the problem I would suggest not to hide the RadWindow in OnClientClick and to leave only the location setting in the codebehind - there is no need to close a hidden window when you are navigating the parent page to another location - RadWindow will be destroyed anyway.
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "modifyconfirm", "GetParentWindow().location = 'http://www.telerik.com/community/forums/aspnet-ajax/window/radwindow-hide-from-javascript-tricks.aspx';", true);
In addition, if the parent page is the topmost page (i.e. the one directly loaded in the browser), you can remove GetParentWindow as well and replace it with top.
e.g. top.location.href = "http://myurl.com";
Best wishes,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
cs137
Top achievements
Rank 1
answered on 06 Dec 2010, 05:38 AM
Hello Georgi,
Thanks for your reply. It seems to it is FF issue. I played a little with items hiding (by adding display=none style) and there is no postback in FF when item has display=none. All other browsers work ok in above case.
Thanks for your reply. It seems to it is FF issue. I played a little with items hiding (by adding display=none style) and there is no postback in FF when item has display=none. All other browsers work ok in above case.