Reload RadGrid from RadWindow

4 posts, 0 answers
  1. Laura
    Laura avatar
    7 posts
    Member since:
    Feb 2012

    Posted 15 Oct 2012 Link to this post

    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!
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5707 posts

    Posted 16 Oct 2012 Link to this post

    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.
  3. Laura
    Laura avatar
    7 posts
    Member since:
    Feb 2012

    Posted 18 Oct 2012 Link to this post

    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.
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5707 posts

    Posted 22 Oct 2012 Link to this post

    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.
Back to Top