Hi,
I have a multipage control that has 5 tabs. On the 2nd tab Ihave a grid which displays order details and on the 5th tab I have another grid which allows the selection of a product to be inserted into the grid on tab #2. When the product row is double-clicked a RadWindow is popped into which the full order details can be added. On completing the data entry a button then inserts the added data into the datatable which is the source of the grid on tab #2 and executes a "CloseAndRebind" script in the window code-behind e.g.:
protected
void
btnInsertClicked(
object
sender, EventArgs e)
{
DataSet ds = Session[
"OrdersTables"
]
as
DataSet;
DataRow nr = ds.Tables[
"LineItems"
].NewRow();
nr[
"LineItem_Id"
] = GetNewItemId(23);
...
.... data inserted into DataRow
...
ds.Tables[
"LineItems"
].Rows.Add(nr);
// update the session
Session.Remove(
"OrdersTables"
);
Session.Add(
"OrdersTables"
, ds);
ClientScript.RegisterStartupScript(Page.GetType(),
"mykey"
,
"CloseAndRebind();"
,
true
);
}
This script comes from one of your examples :
function
CloseAndRebind(args) {
GetRadWindow().BrowserWindow.refreshGrid(args);
GetRadWindow().close();
}
which bubbles back to the parent page and triggers this AJAX request to execute a ReBind on the grid in tab #2
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
DefaultLoadingPanelID
=
"mainLoadingPanel"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid2"
LoadingPanelID
=
"grid2LoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
The AJAX request triggers the NeedDataSource event of the grid on tab #2 to re-load the DataSource however on switching to tab #2 the grid was still showing the old data. At this point clicking the refresh option top-right of the grid the NeedDataSource event is again triggered and this time the new line is displayed.
I'd like the AJAX request to switch to tab #2 and then issue the refresh so coded:
protected
void
RadAjaxManager1_AjaxRequest(
object
sender, AjaxRequestEventArgs e)
{
if
(e.Argument ==
"Rebind"
)
{
// swap back to the order lines tab then refresh it
RadTab rt = RadTabStrip1.Tabs.FindTabByText(
"Order Items"
);
rt.Selected =
true
;
RadGrid1.MasterTableView.SortExpressions.Clear();
RadGrid1.MasterTableView.GroupByExpressions.Clear();
RadGrid1.Rebind();
}
}
However the swap back to tab #2 fails to happen and the grid is still not refreshed.