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

Refresh Grid using ajax on parent window

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 09 Feb 2012, 08:52 PM
I'm trying to have a radwindow force a refresh of a grid on the parent (named "grdLectures")
I have this on the parent window which i can see does run when called from the radwindow :
          function refreshGrid(arg) {
                   if (!arg) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else {      
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                }

my RadAjaxManager is like this:

    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" 
                    OnAjaxRequest="RadAjaxManager1_AjaxRequest"  
DefaultLoadingPanelID
="RadAjaxLoadingPanel1">         <AjaxSettings>           <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">                     <UpdatedControls>                         <telerik:AjaxUpdatedControl ControlID="grdLectures" />                     </UpdatedControls>                 </telerik:AjaxSetting>             <telerik:AjaxSetting AjaxControlID="grdAssets">                 <UpdatedControls>                     <telerik:AjaxUpdatedControl ControlID="grdAssets" />                     <telerik:AjaxUpdatedControl ControlID="grdLectures" />                     <telerik:AjaxUpdatedControl ControlID="msg" />                 </UpdatedControls>             </telerik:AjaxSetting>             <telerik:AjaxSetting AjaxControlID="grdLectures">                 <UpdatedControls>                     <telerik:AjaxUpdatedControl ControlID="grdLectures" />                 </UpdatedControls>             </telerik:AjaxSetting>         </AjaxSettings>     </telerik:RadAjaxManager>

and the Ajax Event handler (which does not get executed as far as I can tell)  :

    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
            grdLectures.MasterTableView.SortExpressions.Clear();
            grdLectures.MasterTableView.GroupByExpressions.Clear();
            grdLectures.Rebind();
        }
        else if (e.Argument == "RebindAndNavigate")
        {
            grdLectures.MasterTableView.SortExpressions.Clear();
            grdLectures.MasterTableView.GroupByExpressions.Clear();
            grdLectures.MasterTableView.CurrentPageIndex = grdLectures.MasterTableView.PageCount - 1;
            grdLectures.Rebind();
        }

2 Answers, 1 is accepted

Sort by
0
david
Top achievements
Rank 1
answered on 09 Feb 2012, 09:01 PM
When I fixed it like this, I changed the js handler that's called from the rad window to be this:

            function refreshGrid(arg) {
                $find("<%= grdLectures.ClientID %>").get_masterTableView().rebind();
            }

Which has the same effect , can someone explain why my other solution didnt work and this did, since I'm assuming the refresh that i force here is causing the Radajaxmanager to call the same code behind anyways?
0
Tsvetoslav
Telerik team
answered on 10 Feb 2012, 09:57 AM
Hi David,

Thank you for contacting us.

If you have the refresshGrid(arg)... method in the parent window and the child windows successfully calls it, there is no reason for the ajax request to fire and the RadAjaxManager1_AjaxRequest handler to get hit on the server. Furthermore, your ajax settings are correct too. Therefore, please carefully compare your implementation to our online example on the same scenario and if the problem persists I'd ask you to paste your complete mark-up and code behind for both the parent and the child windows.

Hope it helps.
 
All the best,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
david
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or