This is a migrated thread and some comments may be shown as answers.

Reload RadGrid from RadWindow

3 Answers 71 Views
Window
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 15 Oct 2012, 03:01 PM
Hello,

we are using a RadGrid with links. If the user clicks a link, it opens a RadWindow which allows the user to send an email. If he clicks the "send"-button within the RadWindow, one image in the Grid changes to indicate the email was send.

But the User doesn't notice the difference until he closes the RadWindow and reloads the page.
Is it therefore possible to reload the RadGrid in the parent page when the user clicks on the button in the RadWindow (best without closing it)?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 16 Oct 2012, 12:28 PM
Hi Laura,

You can call a function declared on the main page that will update the grid from inside the RadWindow. How to do this is explained in the following help article: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html. If you need to execute it after some server code runs you can use the approach from this help article to call the initial function inside the RadWindow: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-javascript-from-server-side.html.


Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Laura
Top achievements
Rank 1
answered on 18 Oct 2012, 08:02 AM
Thanks for the advice. I tried it the following way using ajax request:

Aspx:

<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script type="text/javascript">

function openSendOciWindow(args) {
                var oWnd = $find("<%= RadWindow_OciSend_InfoBox.ClientID %>");
  
                oWnd.setUrl("/Base/Dialogs/Infos/InfoSendOci.aspx?args=" + args);
                oWnd.show();
                oWnd.center();
            }
  
function refreshGrid()
                {
                   $find("<%= RadAjaxManagerIncCoord.ClientID %>").ajaxRequest("Rebind");                              
                }
  
 </script>
    </telerik:RadCodeBlock>
  
<telerik:RadAjaxManager ID="RadAjaxManagerIncCoord" runat="server" EnableAJAX="true"
            DefaultLoadingPanelID="RadAjaxLoadingPanel_IncCoord" OnAjaxRequest="RadAjaxManagerIncCoord_AjaxRequest">
            <ClientEvents OnRequestStart="onRequestStart"></ClientEvents>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManagerIncCoord">   
                <UpdatedControls>   
                    <telerik:AjaxUpdatedControl ControlID="gv_OverviewDetail" />   
                </UpdatedControls>   
            </telerik:AjaxSetting>     
            </AjaxSettings>
</telerik:RadAjaxManager>

C#
protected void RadAjaxManagerIncCoord_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
            if (e.Argument == "Rebind")
            {
                gv_OverviewDetail.MasterTableView.SortExpressions.Clear();
                gv_OverviewDetail.MasterTableView.GroupByExpressions.Clear();
                gv_OverviewDetail.Rebind();
            }
}
  
protected void Page_Load(object sender, EventArgs e)
{
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.AjaxSettings.AddAjaxSetting(manager, gv_OverviewDetail);
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManagerIncCoord_AjaxRequest);   
}

RadWindow:

function saveAndClose() {
    var oWindow = GetRadWindow();
    oWindow.close(null);
  
   GetRadWindow().BrowserWindow.refreshGrid();
}

After the rebind the RadGrid is not shown.. I would appreciate any suggestions.
0
Marin Bratanov
Telerik team
answered on 22 Oct 2012, 11:32 AM
Hi Laura,

I build a small test page with these snippets and things seem to be working fine with me. I am attaching them here as a reference, along with a video from my experiment. What I can suggest is that you review your code and see if there is some other JavaScript error thrown from your code that may prevent the AJAX request from being properly completed. It is also possible that a server error during the AJAX request is causing the issue. If you are still unable to resolve the case after reviewing my sample and comparing it with your actual page I advise that you open a support ticket and send us a simple, runnable project where we can observe the problem.


All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Laura
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Laura
Top achievements
Rank 1
Share this question
or