You guys have helped me out tremendously in getting my radwindow working. I now have another question. When I am finished with my pop-up radwindow I click a button that closes the pop-up and returns to the parent page. How can I make the parent page postback and refresh?
Thanks,
Bob
35 Answers, 1 is accepted

I was after the same question. Here is what I got from telerik.
You can hook to the OnClientClose event of the RadWIndow and use document.location.reload() or document.location.href = document.location.href to reload / refresh the page.
e.g.
<script type="text/javascript">
function OnClientClose(sender,args)
{
//your code here
}
</script>
<telerik:radwindow id="RadWindow1" runat="server" OnClientClose="OnClientClose" />
Best wishes,
Georgi Tunev
the Telerik team
--Brett

function
closeWin()
{
var oWnd = GetRadWindow();
oWnd.close();
document.location.reload();
}
I added the document.location.reload(); line like you suggested. But the parent page still does not refresh after clicking the button. Did I put this line in the proper spot?
Thanks,
Bob
The function that Brett posted should be placed in the parent page - where your RadWindow / RadWindowManager is. This function should also be hooked to the RadWindow with the OnClientClose property as shown in the code.
If you want to put the refreshing code in the content page, you need to replace document with top. This way you will refer to the topmost page which will be the one from which you open the RadWindow.
e.g.
top.location.reload() (equal to pressing F5 on the parent page)
OR
top.location.href = top.location.href;
Best wishes,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Now I am totally confused. I have the following javascript function in the HTML of my pop-up page.
function
closeWin()
{
var oWnd = GetRadWindow();
oWnd.close();
}
Are you telling me that this code should instead be in the HTML of my parent page?
Thanks,
Bob
What I mean was that if you want to refresh the parent page from your content one, you should modify the closeWin() function that you have on the content page:
function closeWin() |
{ |
var oWnd = GetRadWindow(); |
oWnd.close(); |
top.location.href = top.location.href; |
} |
If you need the refreshing code to be called from the parent page, you can use the code that Brett posted. There you hook to the OnClientClose event of the RadWindow which is fired when the RadWindow is closed and call the reloading code there.
I hope this helps.
Regards,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

In my parent:
I have 3 buttons, they all launch windows. My button code looks like this.
<asp:ImageButton |
runat="server" ID="btnContact" ImageUrl="~/lib/img/vcard_add.png" ToolTip="Add Contact" CausesValidation="False" |
OnClientClick="openWin(winContact); return false;"/> |
Then I have my Window Manager and Windows...looks like this:
<telerik:RadWindowManager ID="rwm" runat="server" |
Animation="None" Skin="Default" Behavior="Default" Behaviors="Default" |
InitialBehavior="None" InitialBehaviors="None" Left="" style="display: none;" |
Top="" VisibleStatusbar="False" Width="500px" Height="500px" Overlay="True"> |
<Windows> |
<telerik:RadWindow ID="winContact" runat="server" |
Behavior="Default" Behaviors="Default" InitialBehavior="None" |
InitialBehaviors="None" Left="" NavigateUrl="../contacts/add.aspx" |
style="display:none;" Top="" IconUrl="../../lib/img/vcard_add.png" |
Title="Add Contact"> |
</telerik:RadWindow> |
<telerik:RadWindow id="winListing" runat="server" Behavior="Default" |
Behaviors="Default" InitialBehavior="None" InitialBehaviors="None" Left="" |
NavigateUrl="../listings/add.aspx" style="display:none;" Top="" |
IconUrl="../../lib/img/world_add.png" Title="Add Listing"> |
</telerik:RadWindow> |
<telerik:RadWindow id="winAdvertising" runat="server" Behavior="Default" |
Behaviors="Default" InitialBehavior="None" InitialBehaviors="None" Left="" |
NavigateUrl="../advertising/add.aspx" style="display:none;" Top="" |
IconUrl="../../lib/img/transmit_add.png" Title="Add Advertising"> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
But when I click my buttons I get a run-time error that say "winContact" is undefined or whichever button I click. My javascript looks like this:
<script type="text/javascript"> |
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 oWnd = GetRadWindow(); |
oWnd.close(); |
} |
function openWin() |
{ |
var oWnd = GetRadWindow(); |
oWnd.show(); |
} |
</script> |
What Am I doing wrong?
In the OnClientClick property you have set:
OnClientClick="openWin(winContact); return false;"
Since you haven't defined winContact before, the framework will throw an error. I assume that you wish to open the RadWindow with ID "winContact", am I right? If this is so, you need to set the argument as a string
OnClientClick="openWin('winContact'); return false;" //note the single quotes
And then to set your openWin function like this:
function openWin(winName)
{
var oWnd = GetRadWindowManager().GetWindowByName(winName);
oWnd.show();
}
I hope this helps. Note that the GetRadWindow function is not used - this function is intended to be used in content pages only, when you want to refer the RadWindow in which this page was shown.
More information on the subject and code snippets can be found in the documentation, section Controls / RadWindow / Programming.
Greetings,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Thanks as always.

In this case you should call a Javascript function on the parent page that will refresh the grid only. For a sample implementation of this logic, please check the following demo: Window Editing - note the CloseAndRebind() function in the content page and the refreshGrid() function on the parent.
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

This is just what I need, thanks.
I've tried integrating with my project but am having difficulty getting the following line to work:
GetRadWindow().BrowserWindow.refreshGrid(args);
Is the sourcecode available for this sample? I can't see it in the download.
Thanks, Paul.
If you have installed the latest official release of the RadControls Prometheus suite, the example is available in your Live Demos\Controls\Examples\Integration\GridAndWindow folder.
For convenience I attached the sample files to this thread.
Best wishes,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

I eventually found it in my code suite.
I've located the problem and solved the problem (a typo) - solution works nicely.
Many thanks, Paul.

I followed the example provided in GridAndWindow.Zip by georgi. Thanks for that. I have this problem, when I close the rad window and call the refreshGrid(args) function in parentGrid, I receive a javascript error saying the "object doesn't support this property or method". Any thoughts?
Regards,
Lawanya
Make sure that you are using the new ASP.NET AJAX naming conventions as shown in theChanges and Backwards Compatibility section of the documentation.
If you still experience problems, it will be best to open a support ticket and send us your project - we will check it right away.
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

http://www.telerik.com/community/code-library/submission/b311D-bbcdde.aspx
It used the Prometheus versions of the controls, so there may be a set_Height instead of set_height here or there, but I continue to use this methodology all over the place and it works very well.
Shaun.


function
refreshGrid()
{
var radMgr = $find("<%=PrometheusRadAjaxManager.ClientID %>"); radMgr.ajaxRequest("Rebind");
}
<
telerik:RadAjaxManager ID="PrometheusRadAjaxManager" runat="server" onajaxrequest="PrometheusRadAjaxManager_AjaxRequest">
<AjaxSettings><telerik:AjaxSetting AjaxControlID="PrometheusRadAjaxManager">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="PrometheusRadGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
And in code behind use this code,
protected void PrometheusRadAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
if (e.Argument == "Rebind")
{
PrometheusRadGrid.MasterTableView.SortExpressions.Clear();
PrometheusRadGrid.MasterTableView.GroupByExpressions.Clear();
PrometheusRadGrid.Rebind();
}
}
Hope this helps
Lawanya

The RadAjaxPanel also has an .ajaxRequest() method you can use to initiate an ajax request.
the code is essentially the same on the client:
<script type="text/javascript">
function refreshCalendar()
{
var ajaxPanel = $find("<%=yourAjaxPanel.ClientID %>"); ajaxPanel.ajaxRequest();
}
</script>
All the best,
Lini
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

function OnClientClose(radWindow) |
{ |
if(document.documentElement && document.documentElement.scrollTop) |
{ |
document.documentElement.scroll = ""; |
document.documentElement.style.overflow = ""; |
} else if(document.body) |
{ |
document.body.scroll = ""; |
document.body.style.overflow = ""; |
} |
var ajaxPanel = $find("<%=rapSchedule.ClientID %>"); ajaxPanel.ajaxRequest(); |
} |


Incidentally, here is the new code. I have it assigned to the OnClientClick of a button in my radwindow page:
function CancelEdit() | |
{ | |
GetRadWindow().Close(); | |
var ajaxPanel = $find("<%=rapSchedule.ClientID %>"); ajaxPanel.ajaxRequest(); | |
} |



I had a similar problem to the one that was presented. I had a RadGrid control in an ASP.NET table inside a Rad Multi Page control. Nothing I did seem to update the RadGrid short of refreshing the entire page until I remembered a piece of information in your literature on the RadAjaxManager. Your literature stated that the RadAjaxManager inherited from the Ajax Manager from Microsoft. So I wrapped the grid in an Update Panel and set its update mode property to conditional. Then during the Ajax Request I found the control and forced it to update the panel as the last act. It worked like a charm. My philosophy is why re-invent the wheel when there’s a control for that?

"Microsoft JScript runtime error: 'undefined' is null or not an object"
This happens only when i use OnclientClose button. Here is my code,
<telerik:RadWindowManager ID="Singleton" Modal="true" runat="server" Skin="Office2007">
<Windows>
<telerik:RadWindow Height="400px" Width="750px" runat="server" ID="radwApprover" OnClientClose="javascript:test();return false;"
Modal="true">
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
and here is my javascript function
function test(sender,e) {
alert('Radwindow is being closed.');
};
Can you please help ?
Gary, indeed RadAjaxManager can be easily replaced with standard asp update panel in some simple scenarios. However, it has much more intuitive and easy settings when configuring more complex scenarios. For example with the manager you do not need to specify triggers, to handle the PageRequestManager request events, to use Application.load handler when executing script from the server after AJAX, etc. For many of our customers this is a big convenience and thus we have developed the control. However, if you are dealing with a more simple scenario and you prefer to use standard update panel, you can do that since all of our controls are perfectly integrated with MS AJAX and they do not require using RadAjax.
Djb, when you attach client handlers for RadControls, you should simply set the name of the function which is the handler as shown below:
OnClientClose="test"
while you have tried to attach the handler as for a standard asp button control.
Please, revise your code and let us know e=whether this fixed the problem.
Svetlina Anati
the Telerik team


I am updating the grid before the RadWindow close.
function Close() {
debugger
var id = document.getElementById("<%= hdnCoverId.ClientID %>").value;
var selection = document.getElementById("<%= cmbApallagi.ClientID %>").value;
//alert(id);
var grid = $find("<%=grdCovers.ClientID %>");
var MasterTable = grid.get_masterTableView();
var items = MasterTable.get_dataItems();
// get the # of rows
var length = MasterTable.get_dataItems().length;
for (var i = 0; i < length; i++) {
// get the record
var record = MasterTable.get_dataItems()[i];
var keyValue = record.getDataKeyValue("Id")
var lbNom = record.findElement("lblNominal"); //access the Label
if (keyValue == id && selection == 2) {
//console.log(keyValue);
lbNom.innerText = "1"; // assigning value to label control
}
else
{
lbNom.innerText = "0"; // assigning value to label control
}
}
// and rebind it to the changed data
MasterTable.updateEditedItems();
var oWindowCust = $find('<%= RadWindow2.ClientID %>');
oWindowCust.Close();
}
Everything works fine but the rest of the controls does not work. I mean not a single event is raised.
Any idea ?
Thanks in advance.
Spiros
Hello Spiros,
From the way you reference the controls, it seems they are all on the same page, so the RadWindow's ContentTemplate is used. If this is not the case you would need to access the parent page's grid properly.
The most likely reason for lose of interactivity on the page is a JavaScript error, so I advise that you examine the browser console and debug the scripts to see if/what error is raised in order to fix it.
Regards,
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

i have rad grid in my rad window
it has maximize functionality in rad window
so when i maximize that my grid popup of filter is not open
also i have dropdown is in rad window so when i maximize radwindo my dropdown is also not open
i have attached error image
i have marked error in images
Hello Asutosh,
Based on this information, it seems you are using your RadWindow(s) with their ContentTemplate. In this case all their content is on the same page and z-index rules apply to it: http://www.telerik.com/help/aspnet-ajax/controlling-absolute-positioning-with-zindex.html. A maximized RadWindow gets a very large z-index value, so other absolutely positioned elements like dropdowns would remain behind it.
To avoid this, simply set its ShowOnTopWhenMaximized property to false (it defaults to true).
Regards,
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

I need to update the radWindow control from a button that is located internally in the radwindow.
The scenario I have is as follows:
Since a main form I call radwindow and it displays me another form, which contains a textbox and a radgrid. When I digit something in the textbox and press down on the button to add, I need to reload the radwindow like the effect of having the radwindow.
As I do this?
sorry for my english, is not very good xD!!
Thank you for your help.
Hi Melvin,
I suggest keeping your query in the separate thread you have opened: http://www.telerik.com/forums/how-to-refresh-radwindow.
I would advise that you keep threads concise in the future by posting in relevant threads or opening new ones, instead of branching the main question with another one.
Regards,
Telerik
See What's Next in App Development. Register for TelerikNEXT.