<asp:LinkButton ID="lbAddPhone" runat="server" onclientclick="javascript:InsertPhone(); return false;">+ Phone/Email</asp:LinkButton> |
function InsertPhone() { |
var hid = document.getElementById("<%= hidContactId.ClientID %>"); |
var oWnd = $find("<%= wndAddPhone.ClientID %>"); |
oWnd.setUrl("popup_addcontact.aspx?which=3&id=" + hid.value); |
oWnd.show(); |
} |
protected void btnPhoneSave_Click(object sender, EventArgs e) |
{ |
string closingscript = "closeWin();"; |
ScriptManager.RegisterStartupScript(this, this.GetType(), "closeWin", closingscript, true); |
} |
function closeWin() { |
var wind = GetRadWindow(); |
wind.close(); |
} |
function GetRadWindow() { |
var oWindow = null; |
if (window.radWindow) { |
oWindow = window.radWindow; |
} |
else if (window.frameElement.radWindow) { |
oWindow = window.frameElement.radWindow; |
} |
return oWindow; |
} |
18 Answers, 1 is accepted
I prepared a test demo based on your code - I generated a new Date and appended it to the navigate url in order to mimic the query strings parameters you add.
After I ran the sample I noticed the following:
- When you open the radWindow for the very first time, it opens correctly but when you open it for next time, its size is different. This is caused by the fact that the status bar holds a very long url and a loading image is also shown there. The problem occurs only under IE due to a bug concerning this and it does not present under other browsers. In order to solve the issue, please set ShowContentDuringLoad="false" for the RadWindow - after I did this, the problem disappeared.
- I could not reproduce the problem with the RadWindow closure - it closes as expected.
- The Save and Cancel buttons work properly no matter the RadWindow is shown for first or next time and the javascript is correctly executed.
For your convenience I attached the demo I prepared to test the reported issues - please examine it and in case you need further assistance, please modify my demo in order to replicate the issue, open a new support ticket and send it to me along with detailed explanations and reproduction steps.
Sincerely yours,Svetlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Having MasterPage or RadScriptManager should not make difference and since I do not have your code I am unable to make further assumptions what might be causing the issue. This being said I believe that the best way to proceed is that you prepare a simple reproduction demo, open a new support ticket and send it to me along with detailed reproduction instructions and explanations. Once I receive it, I will debug it, find what is exactly happening and I will get back to you with a solution which you will be then able to include in your original project.
Greetings,
Svetlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Brian,
I'm fairly new at using the radwindow, but I was having the same issue as you are. What I finally stumbled across was this property that seemed to work for me:
DestroyOnClose=true
I am using a RadWindowManager and I set that proerty on it and my window will now close using a similar script as yours...
good luck,
-Randy
<telerik:RadWindowManager ID="rwmAddPhone" runat="server" Skin="Web20" Modal="True" VisibleStatusbar="False" |
VisibleTitlebar="False" ReloadOnShow="True" ShowContentDuringLoad="False" KeepInScreenBounds="True" |
AutoSize="True"> |
</telerik:RadWindowManager> |
<asp:LinkButton ID="lbAddPhone" runat="server" OnClientClick="javascript:InsertPhone(); return false;">+ Phone/Email</asp:LinkButton> |
function InsertPhone() { |
var hid = document.getElementById("<%= hidContactId.ClientID %>"); |
var oWindow = window.radopen("popup_addcontact.aspx?which=3&id=" + hid.value, null); |
} |
protected void btnPhoneSave_Click(object sender, EventArgs e) |
{ |
string closingscript = "closeWin();"; |
ScriptManager.RegisterStartupScript(this, this.GetType(), "closeWin", closingscript, true); |
} |
function GetRadWindow() { |
var oWindow = null; |
if (window.radWindow) { |
oWindow = window.radWindow; |
} |
else if (window.frameElement.radWindow) { |
oWindow = window.frameElement.radWindow; |
} |
return oWindow; |
} |
function closeWin() { |
var wind = GetRadWindow(); |
wind.close(); |
} |
I again tried to reproduce the issue but unfortunately to no avail - please see the attached new test demo. This being said, I believe that the best way to proceed is that you open a new support ticket and send me either mine modified demo or a new reproduction demo which will demonstrate the issue. Please, also include detailed reproduction steps and explanations along with the demo and make sure that it can be run without any modifications. Once I receive it, I will examine it locally and I will find and fix the issue.
Greetings,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
To get around this, I have added this code:
function openRadWindow(url) { |
var manager = GetRadWindowManager(); |
var modalWindow = manager.open(null, "Edit Location"); |
modalWindow.add_close(refreshLocationsGrid); |
modalWindow.setUrl(url); |
var width = 800; |
var height = 460; |
if (parseInt(navigator.appVersion) > 3) { |
if (navigator.appName == "Netscape") { |
height = window.innerHeight; |
} |
if (navigator.appName.indexOf("Microsoft") != -1) { |
height = document.body.offsetHeight; |
} |
} |
modalWindow.setSize(width + 50, height - 50); |
modalWindow.show(); |
} |
Do you by any chance close the RadWindow from the code-behind? If so, I suggest to return the AutoSize setting and execute the closing script with a little timeout, e.g 300 ms. If this is not the case, please prepare a sample reproduction demo, open a new support ticket and send it to us along with detailed explanations and reproduction steps.
Regards,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
function refreshLocationsGrid(sender, args) { |
sender.remove_close(refreshLocationsGrid); |
sender.hide(); |
var button = $get('<%=Button_RefreshLocations.ClientID %>'); |
button.click(); |
} |
This code also causes a button to be clicked which updates a gridview inside of an update panel. I have already tried removing the button click and I get the same results.
Greg, as far as I can see from your code, the sender is the RadWindow object and you want to close it by using the method hide(). Please, note that the hide method of RadWindow is not recommended to be used and in order to close correctly the RadWindow you should call close() instead as explained below:
http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html
In case you still experience the issue, please prepare a sample reproduction demo, open a new support ticket and send it to me along with detailed reproduction steps and I will modify it in order to meet your requirements.
Brian, I am glad that you solved the problem, in case you experience any other problem, do not hesitate to contact us.
Kind regards,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am glad to inform you that we accepted and already included the fix, suggested by Mathew and it will be available in the next build. For the time being we suggest to use the timeout solution as a temporary workaround.
Thanks again for your feedback and cooperation!
All the best,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Could anyone please post an example for the temporary workaround? I tried to use window.setTimeout and set the delay to 300 but that doesn't solve my problem. The only way I can get the RadWindow close is to turn off AutoSize.
Thanks,
Lawrence
<html> |
<body> |
<script type='text/javascript'> |
Event.observe(window, 'load', function() { |
(function() { GetRadWindow().close(); }).defer(); |
}); |
</script> |
</body> |
</html> |
De-prototyped, it should be functionally equivalent to the following:
<html> |
<head> |
<script type='text/javascript'> |
function closeOnLoad() { |
window.setTimeout(function() { GetRadWindow.close(); }, 300); |
} |
</script> |
</head> |
<body onload='closeOnLoad();'> |
</body> |
</html> |
[- deleted message -]
solved itself ^^
- Mario
Can you provide us with a more detailed explanation of the problem, e.g.:
- sample page with the configuration of RadWindow
- a list of steps to reproduce the issue
- the version of our product that you are testing with
- browsers (and their version) in which the problem can be reproduced
Regards,
Stamo Gochev
Telerik