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

Refresh Grid on Window Close Master page AjaxManager/Proxy

3 Answers 144 Views
Window
This is a migrated thread and some comments may be shown as answers.
GDPR_erased
Top achievements
Rank 1
GDPR_erased asked on 25 Jan 2010, 10:49 PM
Could anyone help!
I have racked my brain trying to figure out how to refresh my grid on a radwindow close. It cannot be that complicated, but I just do not have the right combination.
My situation is a little different than the examples. I have looked at the demos:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window
and all the posts, but here is my problem.

I have a Master page with an ajax manager. I then have a content page that I launch the RadWindow. The content page has a AjaxManagerProxy:
I have this part (The VB on the Content Page)
   Protected Sub RadAjaxManagerProxy1_AjaxRequest(ByVal sender As ObjectByVal e As Telerik.Web.UI.AjaxRequestEventArgs)  
        Dim grid As Telerik.Web.UI.RadGrid = DirectCast(FindControl("RadMultiPage1").FindControl("PageSearch").FindControl("grdSearchRFS"), Telerik.Web.UI.RadGrid)  
        If e.Argument = "Rebind" Then 
            grid.MasterTableView.SortExpressions.Clear()  
            grid.MasterTableView.GroupByExpressions.Clear()  
            grid.Rebind()  
        ElseIf e.Argument = "RebindAndNavigate" Then 
            grid.MasterTableView.SortExpressions.Clear()  
            grid.MasterTableView.GroupByExpressions.Clear()  
            grid.MasterTableView.CurrentPageIndex = grid.MasterTableView.PageCount - 1  
            grid.Rebind()  
        End If 
    End Sub 
Now, I need to figure out how to use the Proxy on the content page to call it:

<

 

telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">

 

function refreshGrid(arg)  
            {  
             if(!arg)  
             {  
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");               
                }  
                else 
                {  
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");               
                }  
            }  
 

I assume I would use the above javascript to initiate the ajax proxy request, and on my radwindow, simply call it onClientClose:

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" ShowContentDuringLoad="False" 
        VisibleStatusbar="False" Modal="True" Behaviors="Close, Resize, Move" Height="550px" 
        Width="1000px">  
        <Windows> 
            <telerik:RadWindow ID="CallDetails" runat="server" Left="" NavigateUrl="RFSDetail.aspx" 
                Height="550px" Width="1000px" Style="display: none;" Title="RFS Detail" Top="" 
                OnClientClose="refreshGrid">  
            </telerik:RadWindow> 
        </Windows> 
</telerik:RadWindowManager> 

But I cannot fiure out how to get the proxy manager to call the VB subroutine. There is not a 
 OnAjaxRequest="RadAjaxManager1_AjaxRequest" for a AjaxProxy.

Does this make sense?
Is there anyone who would mind giving me a pointer? Surely this is used all the time!
Thanks,
~bg

3 Answers, 1 is accepted

Sort by
0
GDPR_erased
Top achievements
Rank 1
answered on 27 Jan 2010, 12:56 PM
I may have made it too complicated.....
What I decided to try is simply:
I have a windows manager that has this:
OnClientClose = "RefreshGrid"
<telerik:RadWindow ID="CallDetails" runat="server" Left="" NavigateUrl="RFSDetail.aspx" 
                Height="550px" Width="1000px" Style="display: none;" Title="RFS Detail" Top="" 
                OnClientClose="RefreshGrid">  
</telerik:RadWindow> 
And, on the same page, I am running a scriptblock with this function:
function RefreshGrid() {  
      var masterTable = $find("<%= grdSearchRFS.ClientID %>").get_masterTableView();  
      masterTable.rebind();  
 
      var masterTable1 = $find("<%= grdMyRFS.ClientID %>").get_masterTableView();  
      masterTable1.rebind();  
     }  
 
Lol.. now, I can only get one grid to rebind. Only the last grid in the function rebinds. If I swap them it works either way, but only the last grid in the function refreshes. Is there anyway to get both grids to rebind? I need both grids to rebind. Both grids are in the AjaxManagerProxy, but I dont think that has anything to do with it.
Thanks
0
Fiko
Telerik team
answered on 28 Jan 2010, 04:19 PM
Hi Bill,

The problem comes from the fact that the first call to the rebind() method causes an AJAX postback and the second rebind function is ignored. In this scenario you can use RadXmlHttpPanel control. You need to wrap the grids in that control and simply call its set_value method. This will cause the OnServiceRequest event to be fired and you can call Rebind method of the grids.

I hope this helps.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GDPR_erased
Top achievements
Rank 1
answered on 29 Jan 2010, 12:38 AM
Thank you, I will try this.
Thanks,
~bg
Tags
Window
Asked by
GDPR_erased
Top achievements
Rank 1
Answers by
GDPR_erased
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or