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

Cancel Ajax Request?

2 Answers 73 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 16 Sep 2011, 09:56 PM
I have the following on a page:

radscriptmanager
radajaxpanel
radajaxloadingpanel
button

I wire everything together, click the button and the loading panel displays the image as expected.  However say on the server a process is running very long and I want the user to be able to kill the request.  I don't mean a timeout I want to be able to kill the ajax request by maybe clicking a button embedded within the radajaxloadingpanel.  

Can you tell me if this is possible?

tia 

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 21 Sep 2011, 09:51 AM
Hello Robert,

I would suggest you to review the following help topic which elaborates on canceling Ajax request. Give it a try and let me know if it helps.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Robert
Top achievements
Rank 1
answered on 21 Sep 2011, 08:13 PM
Well.. that's not exactly related but here is the solution:

<script type="text/javascript">

    function CancelAjaxRequest() {

        var obj = Sys.WebForms.PageRequestManager.getInstance();

        if (obj.get_isInAsyncPostBack())

            obj.abortPostBack();

    }

</script>

Put this in a RadAjaxLoadingPanel template:
<asp:button runat="server" onclientclick="CancelAjaxRequest(); return false;"></asp:button>

Tags
Ajax
Asked by
Robert
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Robert
Top achievements
Rank 1
Share this question
or