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

AjaxRequest not firing

3 Answers 187 Views
Window
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 31 Oct 2008, 10:22 AM

Im using a RadWindow as an edit form for an ajax grid.
AjaxRequest isnt being fired when I insert data, which means the grid isnt updating on the parent form

In the Radwindow I have a button that calls the data insert function and closes the window

 InsertBandMember();  
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true); 

this calls the javascript function in the RadWindow edit form

function CloseAndRebind(args) {  
                GetRadWindow().Close();  
                GetRadWindow().BrowserWindow.refreshGrid(args);  
            } 

this then calls the javascript function in the parent form (where the grid lives)

function refreshGrid(arg) {  
            debugger;  
            if (!arg) {  
                $find("<%= Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("Rebind");  
 
            }  
            else {  
                $find("<%= Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindAndNavigate");  
 
            }  
        } 

and finally heres the Ajax Request event handler in the code behind

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

This never gets called, but in the javascript, this line does

$find("<%= Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindAndNavigate");   

Im using an ajax manager on a master page, so ive put an ajaxproxymanager on the grid page
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting>   
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"   
                        LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 

Yet still the grid wont update.  The data is being committed to the database, so how can I get the grid to do an ajax refresh ?

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 03 Nov 2008, 03:10 PM

Hi Mark,

I examined your code and it seems to be correct. Since I do not have your full source code I am not able to find the problem. However, this online demo is very similar to your scenario and I suggest to examine its full source code and ompare it to yours.

When you install RadControls, our online examples projects are automatically installed on your computer and you can not only examine their full source code, but also extend them further in order to meet your requirements.

You can open the demos from here:

Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio

The actual location on your hard disk is the following one:

C:\Program Files\Telerik\RadControls for ASPNET AJAX \Live Demos

If this does not help, please prepare a sample, fully runnable demo (including DB, if needed, e.g Northwind), open a new support ticket and send it to me along with detailed reproduction instructions.


Best wishes,

Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
mww
Top achievements
Rank 1
answered on 04 Nov 2008, 06:45 PM
That was actually the example I based mine on, its practically identical, but mine wont update the grid after an insert
0
kyle goodfriend
Top achievements
Rank 2
answered on 26 Jan 2009, 02:47 AM
Mark, have you resolved this?  I didn't start with the example, but am doing something similar.  My window allows the user to upload images, which is saved in a database.  My grid isn't refreshing either.  I verified that the JS is firing the ajaxRequest.  I see the processing panel image for a split second, but the records aren't updated in the grid.  I figure there one thing I am missing that connects the processes and was hoping your problem would fix mine!
Tags
Window
Asked by
mww
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
mww
Top achievements
Rank 1
kyle goodfriend
Top achievements
Rank 2
Share this question
or