I've got a page with a RadGrid on it and I've setup the RowClick functionality to pop open a new window, pass some parameters and then query the DB based on those.
Here is the code I'm using.
How can I adapt this to refresh the parent page when the user closes that window?
Thanks!
Here is the code I'm using.
function RowClick(sender, eventArgs) |
{ |
var MasterTableView = eventArgs.get_tableView(); |
var cell = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "item"); |
var cell2 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "OrdNumb"); |
var cell3 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "POS"); |
var cell4 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "HdrBuyFromBP"); |
var oWnd = radopen("Details.aspx?item=" + cell.innerHTML + "&Order_No=" + cell2.innerHTML + "&POS=" + cell3.innerHTML + "&BP=" + cell4.innerHTML ); |
} |
</script> |
How can I adapt this to refresh the parent page when the user closes that window?
Thanks!
6 Answers, 1 is accepted
0
Hi DogEars,
If you wish to refresh the parent page when the RadWindow is closed, I suggest to hook to the OnClientClose event of the RadWindow and refresh the page there.
If you want to update the RadGrid only, you can call an Ajax request again from the OnClientClose function.
Best wishes,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you wish to refresh the parent page when the RadWindow is closed, I suggest to hook to the OnClientClose event of the RadWindow and refresh the page there.
<script type="text/javascript"> |
function OnClientClose(sender,args) |
{ |
//window.location.reload();//- will reload the page (equal to pressing F5) |
window.location.href = window.location.href;// - will refresh the page by reloading the URL |
} |
</script> |
<telerik:RadWindowManager ID="RadWindowmanager1" runat="server"> |
<Windows> |
<telerik:RadWindow |
OnClientClose="OnClientClose" |
ID="DefaultWindow" |
runat="server" /> |
</Windows> |
</telerik:RadWindowManager> |
If you want to update the RadGrid only, you can call an Ajax request again from the OnClientClose function.
Best wishes,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
DogEars
Top achievements
Rank 2
answered on 22 Feb 2008, 02:12 AM
I must be doing something wrong somewhere in the process.
Here is the code I have on my default.aspx page, the parent.
And this is what my RadWindow looks like (on the default.aspx page as well):
I've tried this as a modal RadWindow, etc., but my parent page never refreshes...
Here is the code I have on my default.aspx page, the parent.
<script type="text/javascript"> |
function RowClick(sender, eventArgs) |
{ |
var MasterTableView = eventArgs.get_tableView(); |
var cell = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "item"); |
var cell2 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "OrdNumb"); |
var cell3 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "POS"); |
var cell4 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "HdrBuyFromBP"); |
var oWnd = radopen("Details.aspx?item=" + cell.innerHTML + "&Order_No=" + cell2.innerHTML + "&POS=" + cell3.innerHTML + "&BP=" + cell4.innerHTML ); |
} |
function OnClientClose(sender,args) |
{ |
windowwindow.location.href = window.location.href;// - will refresh the page by reloading the URL |
} |
</script> |
And this is what my RadWindow looks like (on the default.aspx page as well):
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Width="800px" Height="600px"> |
<Windows> |
<telerik:RadWindow OnClientClose="OnClientClose" runat="server" /> |
</Windows> |
</telerik:RadWindowManager> |
I've tried this as a modal RadWindow, etc., but my parent page never refreshes...
0
DogEars
Top achievements
Rank 2
answered on 22 Feb 2008, 02:15 AM
Please disregard the last section. I had a silly typo that I didn't notice.
Thanks for all of your assistance! :)
Thanks for all of your assistance! :)
0
Iosu Buenetxea
Top achievements
Rank 1
answered on 12 May 2008, 10:29 AM
Hi
I have to do something similar like this, but I'm using a RadWindow to configure the nodes in my RadTreeview.
I want to refresh only my treeView OnClientClose event, instead of do a page postback.
How can I refresh only treeview in this function using ajax?
Best regards.
0
DogEars
Top achievements
Rank 2
answered on 12 May 2008, 12:45 PM
I believe it would be the same operation, but substituting the controls for the treeview instead of the Radgrid.
This code goes into the parent page code behind: (I have a routine that binds data to my grid that I call here)
This code is in the aspx page of the parent.
This code goes into the aspx page of the RadWindow:
I happen to be using a datalist to do my work in the edit page, you will have to substitute your control accordingly:
This code goes into the parent page code behind: (I have a routine that binds data to my grid that I call here)
Protected Overloads Overrides Sub RaisePostBackEvent(ByVal sourceControl As IPostBackEventHandler, ByVal eventArgument As String) |
MyBase.RaisePostBackEvent(sourceControl, eventArgument) |
If TypeOf sourceControl Is RadAjaxManager Then |
'Rebind the grid after data has been entered |
If eventArgument = "Rebind" Then |
LoadGrid() |
End If |
End If |
End Sub |
This code is in the aspx page of the parent.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function ShowGridEditForm(id, rowIndex) |
{ |
var grid = $find("<%= RadGrid1.ClientID %>"); |
var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); |
grid.get_masterTableView().selectItem(rowControl, true); |
window.radopen("Editgrid.aspx?id=" + id, "GridSelectDialog"); |
return false; |
} |
function refreshGrid(arg) |
{ |
if(!arg) |
{ |
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); |
} |
} |
</script> |
</telerik:RadCodeBlock> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="RadGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
This code goes into the aspx page of the RadWindow:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function CloseAndRebind(args) |
{ |
GetRadWindow().Close(); |
GetRadWindow().BrowserWindow.refreshGrid(args); |
} |
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.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well) |
return oWindow; |
} |
function CancelEdit() |
{ |
GetRadWindow().Close(); |
} |
</script> |
</telerik:RadCodeBlock> |
I happen to be using a datalist to do my work in the edit page, you will have to substitute your control accordingly:
Protected Sub DetailsView1_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles DetailsView1.ItemCommand |
If (e.CommandName = "Update") Then |
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", True) |
Else |
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", True) |
End If |
End Sub |
0
Iosu Buenetxea
Top achievements
Rank 1
answered on 12 May 2008, 02:46 PM
Hi DogEars
Thanks for the help, finally I use the onClientClosing event for the radWindow to rebind my treeView.
Best regards.
Thanks for the help, finally I use the onClientClosing event for the radWindow to rebind my treeView.
Best regards.