AjaxRequests get dropped

3 posts, 1 answers
  1. Ivaylo
    Ivaylo avatar
    12 posts
    Member since:
    Sep 2010

    Posted 27 Sep 2010 Link to this post

    Hi,

    I am using a Rad Grid control inside a user control. I have to support automatic inserts and edits - the insert is implemented by clicking a button in the command item template, and the editing is done by double-clicking the row that contains the item. I have hooked it up with the RowDoubleClick event in the ClientEvents tag and have implemented a custom javascript logic that keeps track of the edited items and triggers ajax requests to the server using a RadAjaxManager. I would like to be able to commit any pending changes to the currently edited item, if I double-click on another one (and have only one active editor).

    the code for this looks like

    function RowDblClick(sender, eventArgs) {
            requestCommit(); // commits any changes to the server to be recorded.
            // initialize items that keep the currently selected row's data.
        }

    function requestCommit() {
            var result = false;
             .....
             // if updating
             manager.ajaxRequest(...);// pass the data to the server to perform update
              // else if inserting
             manager.ajaxRequest(...);// pass the data to the server to perform insert
             // other code skipped for clarity
             return result; // result is true if request attempt was made
        }

    function GridKeyPress(sender, eventArgs) {
            var c = eventArgs.get_keyCode();
            if (c == 13) {
                requestCommit();
            }
        }

    This code works fine when I press the enter key - the data is successfully  submitted. However, I want to submit it when I doubleclick on another row - unfortunately nothing happens - Firebug says that the request was aborted. This happens on FF, IE7, 8 and chrome (I did not test it elsewhere). When I add an alert tag in the requestCommit method before it returns, all works fine.

    Regards,
    Ivaylo Slavov
  2. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 27 Sep 2010 Link to this post

    Could the issue be that you are initiating a ajax request before the previous one completes or are you executing them one after the other, ensuring the previous one complete before executing the next? If the first situation is true, I would suggest increasing the request queue size, I forget the actual property name, but it should contain queue in it. That way mulitple ajax requests will queued one after the other and executed after each one completes.

    I hope that helps.
  3. Ivaylo
    Ivaylo avatar
    12 posts
    Member since:
    Sep 2010

    Posted 28 Sep 2010 Link to this post

    Thanks Cori, it seems that the request size of the RadAjaxManager was the issue.
Back to Top