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

[Solved] Handling OnError during LoadOnDemand AJAX request

0 Answers 105 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jeff
Top achievements
Rank 1
Jeff asked on 11 May 2011, 10:34 PM
Hello - I'm working on error handling from controller->browser alert() during a TreeView's AJAX LoadOnDemand event.  I'm successfully getting the error into my onError(e) javascript routine.  

Controller code...

catch ( Exception ex )
{
    Response.StatusCode = 500;
    return Content( ex.Message );
}

Here's the javascript code (taken from another post)...

function onError(e) {
    if (e.textStatus == 'error') { 
        if (e.XMLHttpRequest.status == "500") { 
            alert("The server was unable to process your request.\n" + e.XMLHttpRequest.responseText);
            e.preventDefault(); 
        } 
    } 
}

This seems to work fine, except the "loading" icon on the tree node never stops spinning.  Is there something in addition to e.preventDefault() I need to do to let the tree know it is not going to get any further response?  Ideally, I'd like it to leave the tree node collapsed with the twisty, so the user can try again.

Thanks!

Jeff
Tags
TreeView
Asked by
Jeff
Top achievements
Rank 1
Share this question
or