Reputation:
I have in my main aspx page a RadGrid which allows the user to open a RadWindow when they click on a picture (within the RadGrid).
When I close my RadWindow I need to rebind my RadGrid. The problem is I'm not in the same page. Thus, I don't have access to the RadGrid in my RadWindow page.
Is there any way to add instructions within CloseDialog to rebind the RadGrid?
This is the code I'm using to close the RadWindow.
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function CloseDialog() {
GetRadWindow().close();
return true;
}
Upvotes: 0
Views: 3839
Reputation: 11154
You can also fire itemcommand for particular row using below code.
function ClientClose(oWnd, args) {
if (oWnd != null && oWnd.get_name() == "checkwindowname") {
var grid = $find("<%=Radgrid1.ClientID %>");
if (grid) {
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
for (var i = 0; i < Rows.length; i++) {
var row = Rows[i];
// put your codition here if you want
MasterTable.fireCommand("YourCommandName", i);
}
}
}
}
Upvotes: 0
Reputation: 1127
Try this:
In radWindow you will get one client event called OnClientClose
, you can call that window and rebind your grid easily. See below what i have done:
<telerik:RadWindow runat="server" Behaviors="Maximize,Close,Move" ID="editorWindow"
VisibleStatusbar="false" Width="800px" ReloadOnShow="true" ShowContentDuringLoad="false"
OnClientClose="OnWindowClose" Modal="true" Height="500px" />
Here is the JS Function :
function OnWindowClose(sender, eventArgs) {
var MasterTable = gridID.get_masterTableView();
MasterTable.rebind();
}
Note: on pageLoad of parent page i have assigned the gridID like this var gridID = $find('<%=radGrid.ClientID%>')
. You can also find/get the grid directly in OnWindowClose
function as my scenario was bit different.
Upvotes: 2