updateItem & subsequent AJAX calls

2 posts, 0 answers
  1. Eric
    Eric avatar
    5 posts
    Member since:
    Apr 2009

    Posted 28 Aug 2009 Link to this post

    I have some javascript which calls the "updateItem" method to update an edited row in my radgrid.

    The updateItem method works fine except for when I call another AJAX grid method right after it such as "editItem" (for a different row).

    It appears that the two asynchronous calls are colliding with each other with the second call causing the first one to never successfully complete.

    Is there a way to call "updateItem" in a synchronous manner?  Or is there a way to capture an event on the client in javscript when the updateItem method finishes so that I can call my second AJAX method thereby eliminating the collision?

    My workaround right now is to call updateItem and then set a timeout to make the second AJAX call.  This works ok over a reliable connection because by the time the timeout calls the second method the first one has "almost always" finished.  Clearly though it would be better to not call the second until I know for a fact the first one ran successfully.

    Any thoughts?
  2. Eric
    Eric avatar
    5 posts
    Member since:
    Apr 2009

    Posted 29 Aug 2009 Link to this post

    I think I solved my problem.  It seems that most (if not all) GridTableView AJAX calls fire the "OnMasterTableViewCreated" event when they complete.  So all I had to do was assign a function to handle the event and then within that function call a pointer to the desired javascript function.  I would set this pointer right before making the AJAX call.  Here is some sample code:


        <telerik:RadGrid ID="SalesForceGrid" runat="server">  
            <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" DataKeyNames="Id" InsertItemDisplay="Bottom" EnableColumnsViewState="false" /> 
                <ClientEvents OnRowClick="RowClick" OnMasterTableViewCreated="MasterTableViewCreated" /> 


                window.afterCallBack = null;  
                function MasterTableViewCreated() {  
                    if (window.afterCallBack != null)  

    window.afterCallBack = function() { FocusFirstColumnControl(false); };  













Back to Top