7 Answers, 1 is accepted
You can try the following approach:
<
ClientSettings
>
<
ClientEvents
OnRowClick
=
"openWindow"
/>
</
ClientSettings
>
var
invoker =
""
;
function
openWindow(sender, args) {
invoker = sender.get_id();
$find(
"<%= RadWindow1.ClientID %>"
).show();
}
function
buttonInWindowClick() {
window.top.$find(window.top.invoker).get_masterTableView().rebind();
}
Hope this helps. Please give it a try and let me know if it works for you.
Kind regards,
Eyup
the Telerik team
Thank you for your help, however, it does not seem to be working for me. Currently I am launching the RadWindow via a CommandButton within RadGrid2. Furthermore, I am also unsure on where I need to execute the code below from. Currently, I am using the upper "X" to close the window, therefore, I do not have a button.
function
buttonInWindowClick() {
window.top.$find(window.top.invoker).get_masterTableView().rebind();
}
In that case, use the rebind logic on the ClientClose event.
That should do the trick. Looking forward to your reply when ready.
In addition, you can check out the following example:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid
Kind regards,
Eyup
the Telerik team
I am experiencing a similar problem, and I feel that I must be missing something simple.
I have a radgrid which auto-refreshes with a Timer.
I want my user to be able to click a hyperlink on a NestedViewTemplate in a radgrid, which will stop the timer and open a radwindow -- a separate page, not a content area -- where they will complete their data operations. On closing the radwindow (whether or not any data is updated), the radgrid should refresh and the timer should re-start.
so I am using
ON PARENT PAGE
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script language="javascript" type="text/javascript">
function openAttachmentsWindow(TicketID) {
var timer = $find('<%= Timer1.ClientID %>');
timer._stopTimer();
var lbl = document.getElementById('<%= lblTimer.ClientID %>');
lbl.innerHTML = 'waiting';
var oWnd = radopen("TicketAttachments.aspx?id=" + TicketID, "radwinAttachments");
return false;
}
function refreshGrid(arg) {
if (!arg) {
document.getElementById('<%=lblTimer.ClientID%>').innerHTML = '';
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
$find("<%= lblTimer.ClientID%>")._startTimer();
}
else {
document.getElementById('<%=lblTimer.ClientID%>').innerHTML = '';
$find('<%= RadAjaxManager1.ClientID %>').ajaxRequest("RebindAndNavigate");
$find('<%=Timer1.ClientID%>')._startTimer();
}
}
</script>
</telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="ddlGridFilter">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1">
</telerik:AjaxUpdatedControl>
<telerik:AjaxUpdatedControl ControlID="lblProblem" LoadingPanelID="RadAjaxLoadingPanel1">
</telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
<telerik:AjaxUpdatedControl ControlID="lblTimer" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
...radgrid...where I want the NestedViewTemplate to update!
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
AutoGenerateColumns="False" AllowAutomaticUpdates="True" OnItemDataBound="RadGrid1_ItemDataBound"
OnPreRender="RadGrid1_PreRender" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated"
OnItemCommand="RadGrid1_ItemCommand" OnDataBound="RadGrid1_DataBound" GridLines="Horizontal" AllowSorting="true" AllowPaging="true" PageSize="50" AllowFilteringByColumn="true"
>
<MasterTableView Name="CallMasterID" DataKeyNames="CallMasterID" TableLayout="Auto" GridLines="Horizontal" CommandItemDisplay="Top" EnableViewState="false">
<%-- panel to display details and buttons for radwindows --%>
<NestedViewTemplate>......</NVT> etc
on its code-behind:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
if (e.Argument == "Rebind")
{
//RadGrid1.MasterTableView.SortExpressions.Clear();
//RadGrid1.MasterTableView.GroupByExpressions.Clear();
RadGrid1.DataSource = null;
RadGrid1.CurrentPageIndex = 0;// GetDataTable(query);
RadGrid1.Rebind();
}
else if (e.Argument == "RebindAndNavigate")
{
//RadGrid1.MasterTableView.SortExpressions.Clear();
//RadGrid1.MasterTableView.GroupByExpressions.Clear();
//RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;
//RadGrid1.Rebind();
RadGrid1.DataSource = null;
RadGrid1.CurrentPageIndex = 0;// GetDataTable(query);
RadGrid1.Rebind();
}
}
ON RADWINDOW PAGE (child) since I want the parent to update n o matter what, I put this in the Page_Unload event. is this causing a problem?
protected void Page_Unload(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
}
Basically, I have done all I can to follow the Grid/Window Integration demo and while my "waiting" label and timer get re-started when the CloseAndRebind() runs, the radgrid and its NVT don't update before the next timer Tick. Can you help?
Thanks!
Amy
This may be to some specific related to AJAX and the Timer. Please temporarily remove the AjaxManager and see whether the functionality will work as expected:
http://demos.telerik.com/aspnet-ajax/ajaxmanager/application-scenarios/ajaxify-timer/defaultcs.aspx
Regards,
Eyup
Telerik by Progress
Thank you Eyup,
I did figure out how to get the timer to stop/start on desired RadWindow open and close.
The issue is that the radgrid and its NestedViewTemplate do not update after updating, but before the next timer Tick event. I must be missing what needs to be done to Ajaxify controls in the NestedViewTemplate of the radgrid. Sorry if I was unclear about that above.
Any thoughts?
Thanks!
Please temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there are any script or server errors interfering, and make sure that the application works without AJAX.
Then, you can try to wrap all of the controls within an asp:Panel and try setting it to the AjaxSettings of the RadAjaxManager alone. Or replace the manager with RadAjaxPanel and place all controls inside.
Regards,
Eyup
Telerik by Progress