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

Refresh RadGrid On Close of RadWindow

1 Answer 115 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ronan BARRANGER
Top achievements
Rank 1
Ronan BARRANGER asked on 21 Mar 2012, 03:40 PM
Greetings,

I have a radgrid with an image on each lines which opens a radwindow. When i close My radwindow i need to refresh the grid which is in the parent page.


This is how i close my radwindow:

                    
    <asp:Button ID="Validation" runat="server" Text="Enregistrer et envoyer l'offre" OnClick="Validation_Click"
OnClientClick="if(Page_ClientValidate()) CloseDialog()" UseSubmitBehavior="false"
 />
    
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;
 
 
}


I tried to do it that way in my parent page:

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
    <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server" Width="700px" Height="500px" Title="Details du ticket"
            Skin="WebBlue" Behaviors="Close, Move" Modal="true" OnClientClose="closeRadWindow">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
JS:

<script type="text/javascript"
function closeRadWindow() 
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();  
</script>
.CS

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    RadGrid1.MasterTableView.SortExpressions.Clear();
    RadGrid1.MasterTableView.GroupByExpressions.Clear();
    RadGrid1.Rebind();
}


It doesn't work. Is there anything i'm missing

(got a JS error with IE ( Property id null or undefined ), & no error but not working at all with firefox)

thanks in advance

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Mar 2012, 03:49 PM
Hi Ronan,

This is working correctly with me: http://screencast.com/t/3iXbQ8opu. You can find here my sample page as well so you can compare it with yours and try to locate the difference that is causing this behavior. What I can suggest is that you review if any other script is throwing an error which will prevent AJAX from working. You can also try calling the ajaxRequest() method with a small timeout. i.e.:
setTimeout(function ()
{
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
}, 100);

If this works you can reduce the timeout, even 0ms could suffice.

Kind regards,
Marin
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
Ronan BARRANGER
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or